|
| 1 | +package tests.validation.other.declarations.typeParameterConstraints.typeParameterOnContainer |
| 2 | + |
| 3 | +annotation MyAnnotation where { |
| 4 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 5 | + »Unresolved« sub MyGlobalClass, |
| 6 | +} |
| 7 | + |
| 8 | +class MyGlobalClass<T1> where { |
| 9 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 10 | + »T1« sub MyGlobalClass, |
| 11 | + |
| 12 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 13 | + »Unresolved« sub MyGlobalClass |
| 14 | +} { |
| 15 | + class MyNestedClass<T2> where { |
| 16 | + // $TEST$ error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 17 | + »T1« sub MyGlobalClass, |
| 18 | + |
| 19 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 20 | + »T2« sub MyGlobalClass, |
| 21 | + |
| 22 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 23 | + »Unresolved« sub MyGlobalClass, |
| 24 | + } |
| 25 | + |
| 26 | + enum MyNestedEnum { |
| 27 | + MyEnumVariant<T2> where { |
| 28 | + // $TEST$ error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 29 | + »T1« sub MyGlobalClass, |
| 30 | + |
| 31 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 32 | + »T2« sub MyGlobalClass, |
| 33 | + |
| 34 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 35 | + »Unresolved« sub MyGlobalClass, |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + fun myMethod<T2>() where { |
| 40 | + // $TEST$ error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 41 | + »T1« sub MyGlobalClass, |
| 42 | + |
| 43 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 44 | + »T2« sub MyGlobalClass, |
| 45 | + |
| 46 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 47 | + »Unresolved« sub MyGlobalClass, |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +enum MyGlobalEnum { |
| 52 | + MyEnumVariant<T1> where { |
| 53 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 54 | + »T1« sub MyGlobalClass, |
| 55 | + |
| 56 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 57 | + »Unresolved« sub MyGlobalClass, |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +fun myGlobalFunction<T1>() where { |
| 62 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 63 | + »T1« sub MyGlobalClass, |
| 64 | + |
| 65 | + // $TEST$ no error "The left operand must refer to a type parameter of the declaration with the constraint." |
| 66 | + »Unresolved« sub MyGlobalClass, |
| 67 | +} |
0 commit comments