forked from JetBrains/kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS: support internal visibility from friend modules
Friend modules should be provided using the -Xfriend-modules flag in the same format as -libraries. No manual configuration required for JPS, Gradle and Maven plugins. Friend modules could be switched off using the -Xfriend-modules-disabled flag. Doing that will * prevent internal declarations from being exported, * values provided by -Xfriend-modules ignored, * raise a compilation error on attemps to use internal declarations from other modules Fixes #KT-15135 and #KT-16568.
- Loading branch information
1 parent
7bbf986
commit 2e9a598
Showing
48 changed files
with
767 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// MODULE: lib | ||
// FILE: lib.kt | ||
|
||
package lib | ||
|
||
internal fun foo() = 1 | ||
|
||
internal val bar = 2 | ||
|
||
internal class A { | ||
internal fun baz(a: Int): Int { | ||
return a * 10 | ||
} | ||
|
||
internal val foo = 3 | ||
|
||
internal inner class B { | ||
internal fun foo() = 4 | ||
} | ||
} | ||
|
||
// MODULE: main(lib)(lib) | ||
// FILE: main.kt | ||
|
||
package main | ||
|
||
import lib.* | ||
|
||
fun box(): String { | ||
if (foo() != 1) return "fail 1: ${foo()}" | ||
if (bar != 2) return "fail 2: ${bar}" | ||
val a = A() | ||
if (a.baz(10) != 100) return "fail 3: ${a.baz(10)}" | ||
if (a.foo != 3) return "fail 4: ${a.foo}" | ||
if (a.B().foo() != 4) return "fail 5: ${a.B().foo()}" | ||
return "OK" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.