Check that kotlin.stdlib is explicitly required in module-info
Writing a Jigsaw-modular Kotlin program which doesn't require kotlin.stdlib doesn't make sense because it most likely will fail at runtime, on access to anything from the standard library. Previously, we checked that kotlin.stdlib was in the module graph, but that's not enough, we should also check that the source module requires it. '-Xallow-kotlin-package' can be used to disable the error. Add a test checking that an indirect (transitive) dependency is also OK
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
||||
OK
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
module namedWithIndirectDependencyViaOtherModule {
|
||||
requires namedWithExplicitDependency;
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
import kotlin.text.Regex
|
||||
|
||||
fun f1(): List<String?> = emptyList()
|
||||
fun f2(): Array<Lazy<Unit>> = arrayOf()
|
||||
fun f3(map: Map<Int, Regex>): Collection<Regex> =
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
+1
-33
@@ -1,34 +1,2 @@
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:1:20: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
import kotlin.text.Regex
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:3:27: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
fun f1(): List<String?> = emptyList()
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:4:17: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
fun f2(): Array<Lazy<Unit>> = arrayOf()
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:4:22: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
fun f2(): Array<Lazy<Unit>> = arrayOf()
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:5:22: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
fun f3(map: Map<Int, Regex>): Collection<Regex> =
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:5:42: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
fun f3(map: Map<Int, Regex>): Collection<Regex> =
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:6:13: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:6:26: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:6:31: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:6:48: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/test.kt:6:61: error: symbol is declared in module 'kotlin.stdlib' which current module does not depend on
|
||||
map.filterNot { (key, entry) -> "$key".equals(entry.toString(), ignoreCase = true) }.values
|
||||
^
|
||||
compiler/testData/javaModules/dependencyOnStdlib/namedWithoutExplicitDependency/module-info.java: error: the Kotlin standard library is not found in the module graph. Please ensure you have the 'requires kotlin.stdlib' clause in your module definition
|
||||
COMPILATION_ERROR
|
||||
|
||||
Reference in New Issue
Block a user