Add equality constraints without subtyping

^KT-42195 Fixed
^KT-41741 Fixed
This commit is contained in:
Victor Petukhov
2020-10-16 14:27:08 +03:00
parent b1b87becc8
commit 84129098cb
20 changed files with 325 additions and 46 deletions
@@ -26,8 +26,8 @@ FILE: upperBoundViolated.kt
lval b5: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
R|/fest|<R|kotlin/Boolean|>()
R|/fest|<R|C|>()
R|/fest|<R|C|>()
R|/fest|<R|B<C>|>()
R|/fest|<R|HHH|>()
R|/fest|<R|JJJ|>()
}
public open class S<F, G : R|F|> : R|kotlin/Any| {
public constructor<F, G : R|F|>(): R|S<F, G>| {
@@ -5,11 +5,11 @@ FILE: concurrentMapOfAliases.kt
super<R|kotlin/Any|>()
}
private final val foo: R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<kotlin/CharSequence, kotlin/CharSequence?>!>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|>()
private get(): R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<kotlin/CharSequence, kotlin/CharSequence?>!>|
private final val foo: R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<MyAlias, MyAlias?>!>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<MyAlias, MyAlias?>!|>()
private get(): R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<MyAlias, MyAlias?>!>|
private final fun bar(): R|kotlin/Unit| {
this@R|/A|.R|/A.foo|.R|FakeOverride<java/util/concurrent/ConcurrentHashMap.get: R|kotlin/CharSequence?|>|(String(dd))?.{ (this@R|/A|, $subj$).R|/A.baz|() }
this@R|/A|.R|/A.foo|.R|FakeOverride<java/util/concurrent/ConcurrentHashMap.get: R|MyAlias?|>|(String(dd))?.{ (this@R|/A|, $subj$).R|/A.baz|() }
}
private final fun R|MyAlias|.baz(): R|kotlin/Unit| {
@@ -3023,6 +3023,29 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/recursiveFlexibleAssertions.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AddEqualityConstraintsWithoutSubtyping extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInAddEqualityConstraintsWithoutSubtyping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt41741.kt")
public void testKt41741() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt");
}
@TestMetadata("kt42195.kt")
public void testKt42195() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)