-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retain HasDefaultParams flag on export. #14051
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f4ce826
Retain HasDefaultParams flag on export.
odersky 340a3b9
Make export of default getters work also with named and given exports
odersky 4d87bb9
Simplify
odersky 6fb3c53
Fix flags of export forwarders
odersky cbff98d
Fix inline + export combination
odersky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 @@ | ||
Hello you | ||
Hello John | ||
Hello you | ||
Hello you | ||
Hello John | ||
Hello you | ||
bark: Woof! |
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,39 @@ | ||
class A: | ||
def greeting(name: String = "you") = s"Hello $name" | ||
|
||
class A2: | ||
inline def greeting(name: String = "you") = s"Hello $name" | ||
|
||
class B: | ||
val a = A() | ||
export a.* | ||
bishabosha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class C: | ||
val a = A2() | ||
export a.greeting | ||
|
||
@main def Test = | ||
val b = B() | ||
|
||
println(b.a.greeting()) // works | ||
println(b.greeting("John")) // works | ||
println(b.greeting()) // nope ! | ||
|
||
val c = C() | ||
|
||
println(c.a.greeting()) // works | ||
println(c.greeting("John")) // works | ||
println(c.greeting()) // nope ! | ||
|
||
val w = Wolf() | ||
import w.given | ||
|
||
println(summon[String]) // error: I found: w.bark(/* missing */summon[String]) | ||
|
||
|
||
class Dog: | ||
given bark(using msg: String = "Woof!"): String = s"bark: $msg" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have found one last issue which is by making class Dog:
inline given bark(using msg: String = "Woof!"): String = s"bark: $msg" gives -- Error: ----------------------------------------------------------------------
31 |summon[String]
| ^
|value dog cannot be accessed as a member of (Wolf_this : (w : Wolf)) from module class i14020$package$.
| This location contains code that was inlined from i14020.scala:39
1 error found There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't get the same error if you try to manually forward to dog.bark in Wolf: class Wolf:
private val dog = Dog()
inline given bark(using msg: String = "Woof!"): String = dog.bark(using msg) |
||
|
||
class Wolf: | ||
private val dog = Dog() | ||
export dog.given // needs to be `export dog.{given, *}` to export the default arguments |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried making
greeting
inline and now we get a crash when callingc.greeting()
, (before this PR is just the standard missing argument error)stack trace