Fix for KT-4413 Do not add error types to supertype lists
The list is not filtered upon creation because it would force lazy types to compute #KT-4413 Fixed
This commit is contained in:
Generated
+3
@@ -1,5 +1,8 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jps-test">
|
||||
<ANNOTATIONS>
|
||||
<root url="file://$PROJECT_DIR$/annotations" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/jps/test" />
|
||||
</CLASSES>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<root>
|
||||
<item name='com.intellij.util.io.TestFileSystemBuilder com.intellij.util.io.TestFileSystemBuilder dir(java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item
|
||||
name='com.intellij.util.io.TestFileSystemBuilder com.intellij.util.io.TestFileSystemBuilder file(java.lang.String, java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='com.intellij.util.io.TestFileSystemBuilder com.intellij.util.io.TestFileSystemBuilder fs()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,12 @@
|
||||
<root>
|
||||
<item name='org.jetbrains.jps.builders.JpsBuildTestCase java.lang.String createFile(java.lang.String, java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='org.jetbrains.jps.builders.JpsBuildTestCase org.jetbrains.jps.builders.BuildResult makeAll()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item
|
||||
name='org.jetbrains.jps.builders.JpsBuildTestCase org.jetbrains.jps.model.module.JpsModule addModule(java.lang.String, java.lang.String...)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='org.jetbrains.jps.model.java.JpsJavaExtensionService org.jetbrains.jps.model.java.JpsJavaExtensionService getInstance()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='org.jetbrains.jps.model.module.JpsModule org.jetbrains.jps.model.module.JpsDependenciesList getDependenciesList()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
+12
@@ -316,6 +316,18 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetType> getSupertypes() {
|
||||
// We cannot have error supertypes because subclasses inherit error functions from them
|
||||
// Filtering right away means copying the list every time, so we check for the rare condition first, and only then filter
|
||||
for (JetType supertype : supertypes) {
|
||||
if (supertype.isError()) {
|
||||
return KotlinPackage.filter(supertypes, new Function1<JetType, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(JetType type) {
|
||||
return !type.isError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return supertypes;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.jps.build
|
||||
|
||||
import org.jetbrains.jps.builders.JpsBuildTestCase
|
||||
import com.intellij.util.PathUtil
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
||||
|
||||
public class SimpleKotlinJpsBuildTest : JpsBuildTestCase() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
System.setProperty("kotlin.jps.tests", "true")
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
System.clearProperty("kotlin.jps.tests")
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
public fun testThreeModulesNoReexport() {
|
||||
val aFile = createFile("a/a.kt",
|
||||
"""
|
||||
trait A1 {
|
||||
fun bar()
|
||||
}
|
||||
trait A2 {
|
||||
fun bar()
|
||||
}
|
||||
""")
|
||||
val a = addModule("a", PathUtil.getParentPath(aFile))
|
||||
|
||||
val bFile = createFile("b/b.kt",
|
||||
"""
|
||||
trait B1 {
|
||||
fun foo(): B2? = null
|
||||
}
|
||||
|
||||
trait B2 : A1, A2 {
|
||||
override fun bar() {}
|
||||
}
|
||||
""")
|
||||
val b = addModule("b", PathUtil.getParentPath(bFile))
|
||||
JpsJavaExtensionService.getInstance().getOrCreateDependencyExtension(
|
||||
b.getDependenciesList().addModuleDependency(a)
|
||||
).setExported(false)
|
||||
|
||||
val cFile = createFile("c/c.kt",
|
||||
"""
|
||||
class C : B1 {
|
||||
fun test() {
|
||||
foo()?.bar()
|
||||
}
|
||||
}
|
||||
""")
|
||||
val c = addModule("c", PathUtil.getParentPath(cFile))
|
||||
c.getDependenciesList().addModuleDependency(b)
|
||||
|
||||
rebuildAll()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user