JVM: add tests on some JPMS-related diagnostics

Somehow we ended up in the state where we have two diagnostics which are
not covered by any tests in the project. This commit adds simple tests
for them.

 #KT-60797
This commit is contained in:
Alexander Udalov
2024-02-08 23:54:59 +01:00
committed by Space Team
parent a5bf8787a1
commit 9fcf6c5f89
10 changed files with 89 additions and 3 deletions
@@ -0,0 +1,6 @@
package foo;
public class Foo {
public int field = 42;
public void method() {}
}
@@ -0,0 +1,3 @@
module lib {
exports foo;
}
@@ -0,0 +1,13 @@
compiler/testData/javaModules/noDependencyOnNamed/main/usage.kt:3:15: error: symbol is declared in module 'lib' which current module does not depend on
fun test(foo: Foo) {
^^^
compiler/testData/javaModules/noDependencyOnNamed/main/usage.kt:4:9: error: symbol is declared in module 'lib' which current module does not depend on
foo.field
^^^^^
compiler/testData/javaModules/noDependencyOnNamed/main/usage.kt:5:9: error: symbol is declared in module 'lib' which current module does not depend on
foo.method()
^^^^^^
compiler/testData/javaModules/noDependencyOnNamed/main/usage.kt:6:5: error: symbol is declared in module 'lib' which current module does not depend on
Foo()
^^^
COMPILATION_ERROR
@@ -0,0 +1,3 @@
module main {
requires kotlin.stdlib;
}
@@ -0,0 +1,7 @@
import foo.*
fun test(foo: Foo) {
foo.field
foo.method()
Foo()
}
@@ -0,0 +1,6 @@
package foo;
public class Foo {
public int field = 42;
public void method() {}
}
@@ -0,0 +1,13 @@
compiler/testData/javaModules/noDependencyOnUnnamed/main/usage.kt:3:15: error: symbol is declared in unnamed module which is not read by current module
fun test(foo: Foo) {
^^^
compiler/testData/javaModules/noDependencyOnUnnamed/main/usage.kt:4:9: error: symbol is declared in unnamed module which is not read by current module
foo.field
^^^^^
compiler/testData/javaModules/noDependencyOnUnnamed/main/usage.kt:5:9: error: symbol is declared in unnamed module which is not read by current module
foo.method()
^^^^^^
compiler/testData/javaModules/noDependencyOnUnnamed/main/usage.kt:6:5: error: symbol is declared in unnamed module which is not read by current module
Foo()
^^^
COMPILATION_ERROR
@@ -0,0 +1,3 @@
module main {
requires kotlin.stdlib;
}
@@ -0,0 +1,7 @@
import foo.*
fun test(foo: Foo) {
foo.field
foo.method()
Foo()
}