Report error on annotated type inside typeOf on JVM

Since it's not feasible to support annotated types in 1.6, we're making
this an explicit error in 1.6, so that typeOf can become stable and this
feature can be supported in the future without breaking changes to the
existing code.

Note that extension function types are a special case of annotated
types. A separate error is created for them just because the message
"annotated types are not supported" would be confusing, since such types
don't have explicit annotations in the source code.

 #KT-29919
This commit is contained in:
Alexander Udalov
2021-07-16 21:38:08 +02:00
parent a383d45534
commit 9ebd665c96
9 changed files with 130 additions and 7 deletions
@@ -672,6 +672,12 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/typeOf"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("annotatedType.kt")
public void testAnnotatedType() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJvmBackend/typeOf/annotatedType.kt");
}
@Test
@TestMetadata("nonReifiedTypeParameterWithRecursiveBound.kt")
public void testNonReifiedTypeParameterWithRecursiveBound() throws Exception {