-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retain default parameters with
export
Default parameters need to have the `HasDefault` flag set to work properly, it seems that without this flag they were still selected but only under join compilation. While we're at it, we define a full set of flags that might be exported. Note that Given/Implicit/Erased were already set by `tpd.DefDef` and Inlined doesn't seem to make a difference in practice since the body of the exported inline def is manually constructed and doesn't contain proxies either way.
- Loading branch information
Showing
6 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object A: | ||
def defaultParam(x: Int = 1) = x | ||
|
||
object Exported: | ||
export A.* |
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,2 @@ | ||
object B: | ||
val x = Exported.defaultParam() |
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,13 @@ | ||
[[syntax trees at end of typer]] // tests/printing/export-param-flags.scala | ||
package <empty> { | ||
final lazy module val A: A = new A() | ||
final module class A() extends Object() { this: A.type => | ||
inline def inlinedParam(inline x: Int): Int = x.+(x):Int | ||
} | ||
final lazy module val Exported: Exported = new Exported() | ||
final module class Exported() extends Object() { this: Exported.type => | ||
export A.* | ||
final inline def inlinedParam(inline x: Int): Int = A.inlinedParam(x) | ||
} | ||
} | ||
|
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,5 @@ | ||
object A: | ||
inline def inlinedParam(inline x: Int): Int = x + x | ||
|
||
object Exported: | ||
export A.* |