Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for struct_literals (0.15 sec)

  1. src/internal/types/testdata/check/compliterals.go

    // license that can be found in the LICENSE file.
    
    // Composite literals with parameterized types
    
    package comp_literals
    
    type myStruct struct {
    	f int
    }
    
    type slice[E any] []E
    
    func struct_literals[S struct{f int}|myStruct]() {
    	_ = S{}
    	_ = S{0}
    	_ = S{f: 0}
    
            _ = slice[int]{1, 2, 3}
            _ = slice[S]{{}, {0}, {f:0}}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 02:58:32 UTC 2022
    - 442 bytes
    - Viewed (0)
  2. src/internal/types/testdata/check/expr3.go

    	var g func(*T) = (*T).m
    	_, _ = f, g
    
    	_ = T.y /* ERROR "has no method" */
    	_ = (*T).y /* ERROR "has no method" */
    }
    
    func struct_literals() {
    	type T0 struct {
    		a, b, c int
    	}
    
    	type T1 struct {
    		T0
    		a, b int
    		u float64
    		s string
    	}
    
    	// keyed elements
    	_ = T1{}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 16 22:41:49 UTC 2023
    - 15.6K bytes
    - Viewed (0)
Back to top