Add JS lookup tracker tests
This commit is contained in:
@@ -1197,6 +1197,8 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractJvmLookupTrackerTest> {
|
||||
model("incremental/lookupTracker/jvm", extension = null, recursive = false)
|
||||
}
|
||||
testClass<AbstractJsLookupTrackerTest> {
|
||||
model("incremental/lookupTracker/js", extension = null, recursive = false)
|
||||
}
|
||||
|
||||
testClass(AbstractIncrementalLazyCachesTest::class.java) {
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.util.containers.HashMap
|
||||
import com.intellij.util.containers.StringInterner
|
||||
import org.jetbrains.kotlin.TestWithWorkingDir
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
@@ -35,6 +37,10 @@ import org.jetbrains.kotlin.incremental.testingUtils.TouchPolicy
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.copyTestSources
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.getModificationsToPerform
|
||||
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
|
||||
import org.jetbrains.kotlin.jps.incremental.runJSCompiler
|
||||
import org.jetbrains.kotlin.jps.incremental.createTestingCompilerEnvironment
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.*
|
||||
@@ -73,6 +79,69 @@ abstract class AbstractJvmLookupTrackerTest : AbstractLookupTrackerTest() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractJsLookupTrackerTest : AbstractLookupTrackerTest() {
|
||||
private lateinit var incrementalDataDir: File
|
||||
private lateinit var binaryTreesDir: File
|
||||
private lateinit var packagesMetadataDir: File
|
||||
private lateinit var headerMetadataFile: File
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
incrementalDataDir = File(workingDir, "incremental-data")
|
||||
binaryTreesDir = File(incrementalDataDir, "binary-trees")
|
||||
packagesMetadataDir = File(incrementalDataDir, "packages-metadata")
|
||||
headerMetadataFile = File(incrementalDataDir, "header.metadata")
|
||||
}
|
||||
|
||||
override fun Services.Builder.registerAdditionalServices() {
|
||||
if (incrementalDataDir.exists()) {
|
||||
register(IncrementalDataProvider::class.java, object : IncrementalDataProvider {
|
||||
override val headerMetadata: ByteArray
|
||||
get() = headerMetadataFile.readBytes()
|
||||
override val packagePartsMetadata: List<ByteArray>
|
||||
get() = packagesMetadataDir.walk().filter { it.isFile }.map { it.readBytes() }.toList()
|
||||
override val binaryTrees: List<ByteArray>
|
||||
get() = binaryTreesDir.walk().filter { it.isFile }.map { it.readBytes() }.toList()
|
||||
})
|
||||
}
|
||||
|
||||
register(IncrementalResultsConsumer::class.java, IncrementalResultsConsumerImpl())
|
||||
}
|
||||
|
||||
override fun runCompiler(filesToCompile: Iterable<File>, env: JpsCompilerEnvironment): Any? {
|
||||
val args = K2JSCompilerArguments().apply {
|
||||
outputFile = File(outDir, "out.js").canonicalPath
|
||||
reportOutputFiles = true
|
||||
freeArgs.addAll(filesToCompile.map { it.canonicalPath })
|
||||
}
|
||||
val exitCode = runJSCompiler(args, env)
|
||||
|
||||
if (exitCode != ExitCode.OK) return exitCode
|
||||
|
||||
val incrementalResults = env.services.get(IncrementalResultsConsumer::class.java) as IncrementalResultsConsumerImpl
|
||||
incrementalResults.apply {
|
||||
packageParts.forEach {
|
||||
val relativePath = it.sourceFile.toRelativeString(srcDir)
|
||||
val treeFile = File(binaryTreesDir, relativePath + ".ast").apply { parentFile.mkdirs() }
|
||||
treeFile.writeBytes(it.binaryAst)
|
||||
|
||||
val partProtoFile = File(packagesMetadataDir, relativePath + ".proto").apply { parentFile.mkdirs() }
|
||||
partProtoFile.writeBytes(it.proto)
|
||||
|
||||
env.outputItemsCollector.outputs.apply {
|
||||
val sources = listOf(it.sourceFile)
|
||||
add(SimpleOutputItem(sources, treeFile))
|
||||
add(SimpleOutputItem(sources, partProtoFile))
|
||||
}
|
||||
}
|
||||
|
||||
headerMetadataFile.parentFile.mkdirs()
|
||||
headerMetadataFile.writeBytes(headerMetadata)
|
||||
}
|
||||
|
||||
return exitCode
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
||||
private val DECLARATION_KEYWORDS = listOf("interface", "class", "enum class", "object", "fun", "operator fun", "val", "var")
|
||||
@@ -174,6 +243,7 @@ abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
||||
val outputItemsCollector = OutputItemsCollectorImpl()
|
||||
val services = Services.Builder().run {
|
||||
register(LookupTracker::class.java, lookupTracker)
|
||||
registerAdditionalServices()
|
||||
build()
|
||||
}
|
||||
val environment = createTestingCompilerEnvironment(messageCollector, outputItemsCollector, services)
|
||||
@@ -193,6 +263,7 @@ abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
||||
return CompilerOutput(exitCode.toString(), messageCollector.errors, filesToCompile, lookupsCount)
|
||||
}
|
||||
|
||||
protected open fun Services.Builder.registerAdditionalServices() {}
|
||||
|
||||
private fun checkLookups(
|
||||
compiledFiles: Iterable<File>,
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.kotlin.jps.build;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("jps-plugin/testData/incremental/lookupTracker/js")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class JsLookupTrackerTestGenerated extends AbstractJsLookupTrackerTest {
|
||||
public void testAllFilesPresentInJs() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/lookupTracker/js"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("classifierMembers")
|
||||
public void testClassifierMembers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/classifierMembers/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("conventions")
|
||||
public void testConventions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/conventions/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("expressionType")
|
||||
public void testExpressionType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/expressionType/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localDeclarations")
|
||||
public void testLocalDeclarations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/localDeclarations/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packageDeclarations")
|
||||
public void testPackageDeclarations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/packageDeclarations/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/js/simple/");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package bar
|
||||
|
||||
// To force creating bar package
|
||||
|
||||
/*p:bar(Dummy)*/private class Dummy
|
||||
@@ -0,0 +1,11 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/bar.kt
|
||||
src/constraints.kt
|
||||
src/foo.kt
|
||||
src/usages.kt
|
||||
Exit code: COMPILATION_ERROR
|
||||
Unresolved reference: vala
|
||||
Unresolved reference: vara
|
||||
Unresolved reference: foo
|
||||
Unresolved reference: bar
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package foo
|
||||
|
||||
import bar.*
|
||||
|
||||
/*p:foo*/fun <T : /*p:foo*/A?, B : /*p:foo p:bar*/Iterable</*p:foo p:bar*/Number>, C, D> test()
|
||||
where C : /*p:foo p:bar*/Number, C : /*p:foo p:bar*/Comparable</*p:foo p:bar*/Number>, D : B
|
||||
{}
|
||||
@@ -0,0 +1,71 @@
|
||||
package foo
|
||||
|
||||
import bar.*
|
||||
|
||||
/*p:foo*/class A {
|
||||
val a = /*p:kotlin(Int)*/1
|
||||
var b = /*p:kotlin(String)*/""
|
||||
|
||||
val c: /*c:foo.A c:foo.A.Companion p:foo p:bar*/String
|
||||
get() = /*c:foo.A p:kotlin(String)*/b
|
||||
|
||||
var d: /*c:foo.A c:foo.A.Companion p:foo p:bar*/String = /*p:kotlin(String)*/"ddd"
|
||||
get() = /*p:kotlin(String)*/field
|
||||
set(v) { /*p:kotlin(String)*/field = /*p:kotlin(String)*/v }
|
||||
|
||||
fun foo() {
|
||||
/*c:foo.A p:kotlin(Int)*/a
|
||||
/*c:foo.A*/foo()
|
||||
/*p:foo(A) p:kotlin(Int)*/this./*c:foo.A*/a
|
||||
/*p:foo(A)*/this./*c:foo.A*/foo()
|
||||
/*c:foo.A c:foo.A.Companion p:foo p:bar*/baz()
|
||||
/*c:foo.A c:foo.A.Companion p:foo p:bar p:kotlin(Int)*/Companion./*c:foo.A.Companion*/a
|
||||
/*c:foo.A c:foo.A.Companion p:foo p:bar p:kotlin(String)*/O./*c:foo.A.O*/v = /*p:kotlin(String)*/"OK"
|
||||
}
|
||||
|
||||
class B {
|
||||
val a = /*p:kotlin(Int)*/1
|
||||
|
||||
companion object CO {
|
||||
fun bar(a: /*c:foo.A.B.CO c:foo.A.B c:foo.A c:foo.A.Companion p:foo p:bar*/Int) {}
|
||||
}
|
||||
}
|
||||
|
||||
inner class C
|
||||
|
||||
companion object {
|
||||
val a = /*p:kotlin(Int)*/1
|
||||
fun baz() {}
|
||||
}
|
||||
|
||||
object O {
|
||||
var v = /*p:kotlin(String)*/"vvv"
|
||||
}
|
||||
}
|
||||
|
||||
/*p:foo*/interface I {
|
||||
var a: /*c:foo.I p:foo p:bar*/Int
|
||||
fun foo()
|
||||
|
||||
class NI
|
||||
}
|
||||
|
||||
/*p:foo*/object Obj : /*p:foo*/I {
|
||||
override var a = /*p:kotlin(Int)*/1
|
||||
override fun foo() {}
|
||||
val b = /*p:kotlin(Int)*/1
|
||||
fun bar(): /*c:foo.Obj p:foo*/I = /*p:kotlin(Nothing) p:foo(I)*/null as /*c:foo.Obj p:foo*/I
|
||||
}
|
||||
|
||||
/*p:foo*/enum class E {
|
||||
X,
|
||||
Y;
|
||||
|
||||
val a = /*p:kotlin(Int)*/1
|
||||
fun foo() {
|
||||
/*c:foo.E p:kotlin(Int)*/a
|
||||
/*c:foo.E p:foo p:bar p:kotlin(Int)*/Y./*c:foo.E*/a
|
||||
/*c:foo.E*/foo()
|
||||
/*c:foo.E p:foo p:bar*/X./*c:foo.E*/foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package foo
|
||||
|
||||
import bar.*
|
||||
|
||||
/*p:foo*/fun usages(i: /*p:foo*/I) {
|
||||
/*p:foo c:foo.A.Companion(invoke) p:foo(invoke) p:kotlin(Int)*/A()./*c:foo.A*/a
|
||||
/*p:foo c:foo.A.Companion(invoke) p:foo(invoke) p:kotlin(String)*/A()./*c:foo.A*/b
|
||||
/*p:foo c:foo.A.Companion(invoke) p:foo(invoke) p:kotlin(String)*/A()./*c:foo.A*/c
|
||||
/*p:foo c:foo.A.Companion(invoke) p:foo(invoke) p:kotlin(String)*/A()./*c:foo.A*/d = /*p:kotlin(String)*/"new value"
|
||||
/*p:foo c:foo.A.Companion(invoke) p:foo(invoke)*/A()./*c:foo.A*/foo()
|
||||
/*p:foo p:kotlin(Int)*/A./*c:foo.A c:foo.A.Companion c:foo.A.B.CO(invoke)*/B()./*c:foo.A.B*/a
|
||||
/*p:foo*/A./*c:foo.A*/B./*c:foo.A.B c:foo.A.B.CO*/bar(1)
|
||||
/*p:foo*/A./*c:foo.A*/B./*c:foo.A.B*/CO./*c:foo.A.B.CO*/bar(1)
|
||||
/*p:foo c:foo.A(Companion)*/A
|
||||
/*p:foo p:kotlin(Int)*/A./*c:foo.A.Companion c:foo.A*/a
|
||||
/*p:foo*/A./*c:foo.A c:foo.A.Companion*/baz()
|
||||
/*p:foo c:foo.A(Companion)*/A./*c:foo.A.Companion c:foo.A*/Companion
|
||||
/*p:foo*/A./*c:foo.A*/Companion./*c:foo.A.Companion*/baz()
|
||||
/*p:foo c:foo.A(O)*/A./*c:foo.A.Companion c:foo.A*/O
|
||||
/*p:foo p:kotlin(String)*/A./*c:foo.A*/O./*c:foo.A.O*/v = /*p:kotlin(String)*/"OK"
|
||||
/*p:foo*/A./*c:foo.A.Companion c:foo.A p:foo p:bar*/vala
|
||||
/*p:foo*/A./*c:foo.A c:foo.A.Companion p:foo p:bar*/vara()
|
||||
|
||||
/*p:foo(I) p:kotlin(Int)*/i./*c:foo.I*/a = /*p:kotlin(Int)*/2
|
||||
/*p:foo p:kotlin(Int)*/Obj./*c:foo.Obj*/a
|
||||
/*p:foo*/Obj./*c:foo.Obj*/foo()
|
||||
var ii: /*p:foo*/I = /*p:foo*/Obj
|
||||
/*p:foo(I) p:kotlin(Int)*/ii./*c:foo.I*/a
|
||||
/*p:foo(I)*/ii./*c:foo.I*/foo()
|
||||
/*p:foo p:kotlin(Int)*/Obj./*c:foo.Obj*/b
|
||||
val iii = /*p:foo p:foo(I)*/Obj./*c:foo.Obj*/bar()
|
||||
/*p:foo(I)*/iii./*c:foo.I*/foo()
|
||||
|
||||
/*p:foo p:bar*/E./*c:foo.E*/X
|
||||
/*p:foo p:bar p:kotlin(Int)*/E./*c:foo.E*/X./*c:foo.E*/a
|
||||
/*p:foo p:bar*/E./*c:foo.E*/Y./*c:foo.E*/foo()
|
||||
/*p:foo p:bar p:kotlin(Array)*/E./*c:foo.E*/values()
|
||||
/*p:foo p:bar*/E./*c:foo.E*/valueOf(/*p:kotlin(String)*/"")
|
||||
/*p:foo p:bar*/E./*c:foo.E*/foo
|
||||
/*p:foo p:bar*/E./*c:foo.E*/bar()
|
||||
}
|
||||
|
||||
/*p:foo*/fun classifiers(
|
||||
a: /*p:foo*/A,
|
||||
ab: /*p:foo*/A./*c:foo.A*/B,
|
||||
ac: /*p:foo*/A./*c:foo.A*/C,
|
||||
abCo: /*p:foo*/A./*c:foo.A*/B./*c:foo.A.B*/CO,
|
||||
aCompanion: /*p:foo*/A./*c:foo.A*/Companion,
|
||||
aO: /*p:foo*/A./*c:foo.A*/O,
|
||||
i: /*p:foo*/I,
|
||||
ni: /*p:foo*/I./*c:foo.I*/NI,
|
||||
obj: /*p:foo*/Obj,
|
||||
e: /*p:foo*/E
|
||||
) {}
|
||||
@@ -0,0 +1,16 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/comparison.kt
|
||||
src/declarations.kt
|
||||
src/delegateProperty.kt
|
||||
src/mathematicalLike.kt
|
||||
src/other.kt
|
||||
Exit code: OK
|
||||
|
||||
==== STEP 1 ====
|
||||
Compiling files:
|
||||
src/comparison.kt
|
||||
src/delegateProperty.kt
|
||||
src/mathematicalLike.kt
|
||||
src/other.kt
|
||||
Exit code: OK
|
||||
@@ -0,0 +1,18 @@
|
||||
package foo.bar
|
||||
|
||||
/*p:foo.bar*/fun testComparisons(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int, c: /*p:foo.bar*/Any, na: /*p:foo.bar*/A?) /*p:kotlin(Boolean)*/{
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/== /*p:kotlin(Any)*/c
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/!= /*p:kotlin(Any)*/c
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/na /*c:foo.bar.A(equals)*/== /*p:foo.bar(A)*/a
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/na /*c:foo.bar.A(equals)*/== /*p:kotlin(Nothing)*/null
|
||||
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo)*/> /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo)*/< /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo)*/>= /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo)*/<= /*p:kotlin(Int)*/b
|
||||
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo)*/> /*p:kotlin(Any)*/c
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo)*/< /*p:kotlin(Any)*/c
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo)*/>= /*p:kotlin(Any)*/c
|
||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo)*/<= /*p:kotlin(Any)*/c
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package foo.bar
|
||||
|
||||
/*p:foo.bar*/class A {
|
||||
operator fun plus(a: /*c:foo.bar.A p:foo.bar*/Int) = /*p:foo.bar(A)*/this
|
||||
operator fun timesAssign(a: /*c:foo.bar.A p:foo.bar*/Any?) {}
|
||||
operator fun inc(): /*c:foo.bar.A p:foo.bar*/A = /*p:foo.bar(A)*/this
|
||||
|
||||
operator fun get(i: /*c:foo.bar.A p:foo.bar*/Int) = /*p:kotlin(Int)*/1
|
||||
operator fun contains(a: /*c:foo.bar.A p:foo.bar*/Int): /*c:foo.bar.A p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/false
|
||||
operator fun invoke() {}
|
||||
|
||||
operator fun compareTo(a: /*c:foo.bar.A p:foo.bar*/Int) = /*p:kotlin(Int)*/0
|
||||
|
||||
operator fun component1() = /*p:foo.bar(A)*/this
|
||||
|
||||
operator fun iterator() = /*p:foo.bar(A)*/this
|
||||
operator fun next() = /*p:foo.bar(A)*/this
|
||||
}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.minus(a: /*p:foo.bar*/Int) = /*p:foo.bar(A)*/this
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.divAssign(a: /*p:foo.bar*/Any?) {}
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.dec(): /*p:foo.bar*/A = /*p:foo.bar(A)*/this
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.not() {}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.set(i: /*p:foo.bar*/Int, v: /*p:foo.bar*/Int) {}
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.contains(a: /*p:foo.bar*/Any): /*p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/true
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.invoke(i: /*p:foo.bar*/Int) {}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.compareTo(a: /*p:foo.bar*/Any) = /*p:kotlin(Int)*/0
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.component2() = /*p:foo.bar(A)*/this
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A?.iterator() = /*p:foo.bar(A)*/this!!
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.hasNext(): /*p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/false
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package foo.bar
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
/*p:foo.bar*/class D1 {
|
||||
operator fun getValue(t: /*c:foo.bar.D1 p:foo.bar*/Any?, p: /*c:foo.bar.D1*/KProperty<*>) = /*p:kotlin(Int)*/1
|
||||
}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D1.setValue(t: /*p:foo.bar*/Any?, p: KProperty<*>, v: /*p:foo.bar*/Int) {}
|
||||
|
||||
/*p:foo.bar(D2)*/open class D2 {
|
||||
operator fun setValue(t: /*c:foo.bar.D2 p:foo.bar*/Any?, p: /*c:foo.bar.D2*/KProperty<*>, v: /*c:foo.bar.D2 p:foo.bar*/Int) {}
|
||||
}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.getValue(t: /*p:foo.bar*/Any?, p: KProperty<*>) = /*p:kotlin(Int)*/1
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.provideDelegate(p: /*p:foo.bar*/Any?, k: /*p:foo.bar*/Any) = /*p:foo.bar(D2)*/this
|
||||
|
||||
/*p:foo.bar*/class D3 : /*p:foo.bar*/D2() {
|
||||
operator fun provideDelegate(p: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar*/Any?, k: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar*/Any) = /*p:foo.bar(D3)*/this
|
||||
}
|
||||
|
||||
|
||||
/*p:foo.bar*/val x1 by /*p:foo.bar c:foo.bar.D1(provideDelegate) p:foo.bar(provideDelegate) c:foo.bar.D1(getValue)*/D1()
|
||||
/*p:foo.bar*/var y1 by /*p:foo.bar c:foo.bar.D1(provideDelegate) p:foo.bar(provideDelegate) c:foo.bar.D1(getValue) c:foo.bar.D1(setValue) p:foo.bar(setValue)*/D1()
|
||||
|
||||
/*p:foo.bar*/val x2 by /*p:foo.bar c:foo.bar.D2(provideDelegate) p:foo.bar(provideDelegate) c:foo.bar.D2(getValue) p:foo.bar(getValue)*/D2()
|
||||
/*p:foo.bar*/var y2 by /*p:foo.bar c:foo.bar.D2(provideDelegate) p:foo.bar(provideDelegate) c:foo.bar.D2(getValue) p:foo.bar(getValue) c:foo.bar.D2(setValue)*/D2()
|
||||
|
||||
/*p:foo.bar*/val x3 by /*p:foo.bar c:foo.bar.D3(provideDelegate) c:foo.bar.D2(provideDelegate) c:foo.bar.D3(getValue) c:foo.bar.D2(getValue) p:foo.bar(getValue)*/D3()
|
||||
/*p:foo.bar*/var y3 by /*p:foo.bar c:foo.bar.D3(provideDelegate) c:foo.bar.D2(provideDelegate) c:foo.bar.D3(getValue) c:foo.bar.D2(getValue) p:foo.bar(getValue) c:foo.bar.D3(setValue) c:foo.bar.D2(setValue)*/D3()
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package foo.bar
|
||||
|
||||
/*p:foo.bar*/fun testOperators(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int) {
|
||||
var d = /*p:foo.bar(A)*/a
|
||||
|
||||
/*p:foo.bar(A)*/d/*c:foo.bar.A(inc)*/++
|
||||
/*c:foo.bar.A(inc) p:foo.bar(A)*/++/*p:foo.bar(A)*/d
|
||||
/*p:foo.bar(A)*/d/*c:foo.bar.A(dec) p:foo.bar(dec)*/--
|
||||
/*c:foo.bar.A(dec) p:foo.bar(dec) p:foo.bar(A)*/--/*p:foo.bar(A)*/d
|
||||
|
||||
/*p:foo.bar(A)*/a /*c:foo.bar.A(plus)*/+ /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A)*/a /*c:foo.bar.A(minus) p:foo.bar(minus)*/- /*p:kotlin(Int)*/b
|
||||
/*c:foo.bar.A(not) p:foo.bar(not)*/!/*p:foo.bar(A)*/a
|
||||
|
||||
// for val
|
||||
/*p:foo.bar(A)*/a /*c:foo.bar.A(timesAssign)*/*= /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A)*/a /*c:foo.bar.A(divAssign) p:foo.bar(divAssign)*//= /*p:kotlin(Int)*/b
|
||||
|
||||
// for var
|
||||
/*p:foo.bar(A)*/d /*c:foo.bar.A(plusAssign) p:foo.bar(plusAssign) c:foo.bar.A(plus)*/+= /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A)*/d /*c:foo.bar.A(minusAssign) p:foo.bar(minusAssign) c:foo.bar.A(minus) p:foo.bar(minus)*/-= /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A)*/d /*c:foo.bar.A(timesAssign) c:foo.bar.A(times) p:foo.bar(times)*/*= /*p:kotlin(Int)*/b
|
||||
/*p:foo.bar(A)*/d /*c:foo.bar.A(divAssign) p:foo.bar(divAssign) c:foo.bar.A(div) p:foo.bar(div)*//= /*p:kotlin(Int)*/b
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package foo.bar
|
||||
|
||||
/*p:foo.bar*/fun testOther(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int, c: /*p:foo.bar*/Any, na: /*p:foo.bar*/A?) {
|
||||
/*p:foo.bar(A) c:foo.bar.A(set) p:foo.bar(set)*/a[1] = /*p:foo.bar(A) c:foo.bar.A(get) p:kotlin(Int)*/a[2]
|
||||
|
||||
/*p:kotlin(Int) p:kotlin(Boolean)*/b /*c:foo.bar.A(contains)*/in /*p:foo.bar(A)*/a
|
||||
/*p:kotlin(String) p:kotlin(Boolean)*/"s" /*c:foo.bar.A(contains) p:foo.bar(contains)*/!in /*p:foo.bar(A)*/a
|
||||
|
||||
/*c:foo.bar.A(invoke)*/a()
|
||||
/*c:foo.bar.A(invoke) p:foo.bar p:foo.bar(invoke)*/a(1)
|
||||
|
||||
val (/*c:foo.bar.A(component1)*/h, /*c:foo.bar.A(component2) p:foo.bar(component2)*/t) = /*p:foo.bar(A)*/a;
|
||||
|
||||
for ((/*c:foo.bar.A(component1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2)*/s) in /*p:foo.bar(A) c:foo.bar.A(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) c:foo.bar.A(next)*/a);
|
||||
for ((/*c:foo.bar.A(component1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2)*/s) in /*p:foo.bar(A) c:foo.bar.A(iterator) p:foo.bar(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) c:foo.bar.A(next)*/na);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/genericType.kt
|
||||
src/inferredType.kt
|
||||
src/lambdaParameterType.kt
|
||||
src/localInnerClassType.kt
|
||||
Exit code: OK
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package foo
|
||||
|
||||
// From KT-10772 Problem with daemon on Idea 15.0.3 & 1-dev-25
|
||||
|
||||
/*p:foo*/fun <T> identity(): (T) -> T = /*p:kotlin(Nothing) p:kotlin(Function1)*/null as (T) -> T
|
||||
|
||||
/*p:foo*/fun <T> compute(f: () -> T) {
|
||||
val result = f()
|
||||
}
|
||||
|
||||
/*p:foo*/class Bar<T>(val t: T) {
|
||||
init {
|
||||
val a = /*c:foo.Bar c:foo.Bar(T)*/t
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
/*p:foo(A)*/open class A
|
||||
/*p:foo*/class B : /*p:foo*/A()
|
||||
|
||||
/*p:foo*/fun getA() = /*p:foo*/A()
|
||||
/*p:foo*/fun getB() = /*p:foo*/B()
|
||||
|
||||
/*p:foo*/fun getListOfA() = /*p:foo p:kotlin.collections(List) p:foo(A)*/listOf(/*p:foo*/A())
|
||||
/*p:foo*/fun getListOfB() = /*p:foo p:kotlin.collections(List) p:foo(B)*/listOf(/*p:foo*/B())
|
||||
|
||||
/*p:foo*/fun useListOfA(a: /*p:foo*/List</*p:foo*/A>) {}
|
||||
/*p:foo*/fun useListOfB(b: /*p:foo*/List</*p:foo*/B>) {}
|
||||
|
||||
/*p:foo*/fun testInferredType() {
|
||||
/*p:foo*/useListOfA(/*p:foo p:kotlin.collections(List) p:foo(A)*/getListOfA())
|
||||
/*p:foo*/useListOfA(/*p:foo p:kotlin.collections(List) p:foo(B)*/getListOfB())
|
||||
/*p:foo*/useListOfB(/*p:foo p:kotlin.collections(List) p:foo(B)*/getListOfB())
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package foo
|
||||
|
||||
/*p:foo*/class C
|
||||
|
||||
/*p:foo*/fun lambdaConsumer(fn: (/*p:foo*/A)->/*p:foo*/Unit) {}
|
||||
/*p:foo*/fun extensionConsumer(fn: /*p:foo*/A.()->/*p:foo*/Unit) {}
|
||||
|
||||
/*p:foo*/fun testLambdaParameterType() {
|
||||
/*p:foo*/lambdaConsumer /*p:kotlin(Function1) p:foo(A)*/{ /*p:foo(A)*/it }
|
||||
/*p:foo*/extensionConsumer /*p:kotlin(Function1) p:foo(A)*/{ /*p:foo(A)*/this }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package foo
|
||||
|
||||
/*p:foo*/fun bar() {
|
||||
class A {
|
||||
inner class B
|
||||
}
|
||||
|
||||
val b = A().B()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package bar
|
||||
@@ -0,0 +1,5 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/bar.kt(no lookups)
|
||||
src/locals.kt
|
||||
Exit code: OK
|
||||
@@ -0,0 +1,49 @@
|
||||
package local.declarations
|
||||
|
||||
import bar.*
|
||||
|
||||
/*p:local.declarations*/fun f(p: /*p:local.declarations p:bar*/Any) /*p:kotlin(Int)*/{
|
||||
/*p:kotlin(Any) p:kotlin(String)*/p.toString()
|
||||
|
||||
val a = /*p:kotlin(Int)*/1
|
||||
val b = /*p:kotlin(Int)*/a
|
||||
fun localFun() = /*p:kotlin(Int)*/b
|
||||
fun /*p:local.declarations p:bar*/Int.localExtFun() = /*p:kotlin(Int)*/localFun()
|
||||
|
||||
abstract class LocalI {
|
||||
abstract var a: /*p:local.declarations p:bar*/Int
|
||||
abstract fun foo()
|
||||
}
|
||||
|
||||
class LocalC : LocalI() {
|
||||
override var a = /*p:kotlin(Int)*/1
|
||||
|
||||
override fun foo() {}
|
||||
|
||||
var b = /*p:kotlin(String)*/"bbb"
|
||||
|
||||
fun bar() = /*p:kotlin(Int)*/b
|
||||
}
|
||||
|
||||
val o = object {
|
||||
val a = /*p:kotlin(String)*/"aaa"
|
||||
fun foo(): LocalI = /*p:kotlin(Nothing)*/null as LocalI
|
||||
}
|
||||
|
||||
/*p:kotlin(Int)*/localFun()
|
||||
/*p:kotlin(Int)*/1.localExtFun()
|
||||
|
||||
val c = LocalC()
|
||||
/*p:kotlin(Int)*/c.a
|
||||
/*p:kotlin(String)*/c.b
|
||||
c.foo()
|
||||
/*p:kotlin(Int)*/c.bar()
|
||||
|
||||
val i: LocalI = c
|
||||
/*p:kotlin(Int)*/i.a
|
||||
i.foo()
|
||||
|
||||
/*p:kotlin(String)*/o.a
|
||||
val ii = o.foo()
|
||||
/*p:kotlin(Int)*/ii.a
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package bar
|
||||
|
||||
/*p:bar*/class A
|
||||
|
||||
/*p:bar*/class B
|
||||
|
||||
/*p:bar*/object O
|
||||
@@ -0,0 +1,7 @@
|
||||
package baz
|
||||
|
||||
/*p:baz*/class A
|
||||
|
||||
/*p:baz*/class B
|
||||
|
||||
/*p:baz*/class C
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/bar.kt
|
||||
src/baz.kt
|
||||
src/foo1.kt
|
||||
src/foo2.kt
|
||||
Exit code: OK
|
||||
|
||||
==== STEP 1 ====
|
||||
Compiling files:
|
||||
src/foo1.kt
|
||||
src/foo2.kt
|
||||
Exit code: OK
|
||||
@@ -0,0 +1,17 @@
|
||||
package foo
|
||||
|
||||
import bar.*
|
||||
/*p:baz(C)*/import baz.C
|
||||
|
||||
/*p:foo*/val a = /*p:foo p:bar*/A()
|
||||
/*p:foo*/var b: /*p:foo p:bar*/baz./*p:baz*/B = /*p:foo p:bar p:baz(B)*/baz./*p:baz*/B()
|
||||
|
||||
/*p:foo*/fun function(p: /*p:foo p:bar*/B): /*p:foo p:bar*/B /*p:kotlin(Nothing)*/{
|
||||
/*p:foo p:bar(A)*/a
|
||||
/*p:kotlin(Nothing)*/return /*p:foo p:bar*/B()
|
||||
}
|
||||
|
||||
/*p:foo*/fun /*p:foo*/MyClass.extFunc(p: /**p:foo p:bar*//*p:foo p:bar*/Array</*p:foo p:bar*/B>, e: /*p:foo*/MyEnum, c: /**???*//*p:baz*/C): /*p:foo*/MyInterface /*p:kotlin(Nothing)*/{
|
||||
/*c:foo.MyClass p:foo p:bar p:baz(B)*/b
|
||||
/*p:kotlin(Nothing)*/return /*c:foo.MyClass p:foo p:bar*/MyClass()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package foo
|
||||
|
||||
/*p:foo*/interface MyInterface
|
||||
|
||||
/*p:foo*/class MyClass : /*p:foo*/MyInterface
|
||||
|
||||
/*p:foo*/enum class MyEnum
|
||||
@@ -0,0 +1,4 @@
|
||||
==== INITIAL BUILD ====
|
||||
Compiling files:
|
||||
src/main.kt
|
||||
Exit code: OK
|
||||
@@ -0,0 +1,6 @@
|
||||
package foo.bar
|
||||
|
||||
/*p:foo.bar*/fun main(args: /*p:foo.bar*/Array</*p:foo.bar*/String>) {
|
||||
val f: /*p:foo.bar*/Array</*p:foo.bar*/Int>
|
||||
val s: /*p:foo.bar*/String
|
||||
}
|
||||
Reference in New Issue
Block a user