Home | History | Annotate | Download | only in test

Lines Matching refs:type

7 // Test basic restrictions on type aliases.
16 type T0 struct{}
18 // Valid type alias declarations.
20 type _ = T0
21 type _ = int
22 type _ = struct{}
23 type _ = reflect.Value
24 type _ = Value
26 type (
37 // Methods can be declared on the original named type and the alias.
44 // Type aliases and the original type name can be used interchangeably.
49 var _ N0 = T0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type"
50 var _ N0 = A0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type"
65 type _ = T0
66 type _ = int
67 type _ = struct{}
68 type _ = reflect.Value
69 type _ = Value
71 type (
85 var _ N0 = T0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type"
86 var _ N0 = A0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type"
88 var _ A5 = Value{} // ERROR "cannot use reflect\.Value literal \(type reflect.Value\) as type A5 in assignment|incompatible type"
91 // Invalid type alias declarations.
93 type _ = reflect.ValueOf // ERROR "reflect.ValueOf is not a type|expected type"
95 func (A1) m() {} // ERROR "cannot define new methods on non-local type int|may not define methods on non-local type"
96 func (A2) m() {} // ERROR "invalid receiver type"
97 func (A3) m() {} // ERROR "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type"
98 func (A4) m() {} // ERROR "reflect.Value.m redeclared in this block" "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type"
100 type B1 = struct{}
102 func (B1) m() {} // ERROR "m redeclared in this block" "invalid receiver type"