-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Trait constructors on scala.js #7377
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
Conversation
Signed-off-by: Carlos Quiroz <[email protected]>
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
@@ -78,6 +78,12 @@ class LinkScala2Impls extends MiniPhase with IdentityDenotTransformer { thisPhas | |||
val impl = implMethod(sel.symbol) | |||
if (impl.exists) Apply(ref(impl), This(currentClass) :: args).withSpan(app.span) | |||
else app // could have been an abstract method in a trait linked to from a super constructor | |||
case Apply(sel @ Select(Super(a, b), _), args) |
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.
This part should be improved but basically tells to do the transform for constructors even on scala.js
if (meth.isConstructor) | ||
if (meth.isConstructor) { | ||
if (ctx.settings.scalajs.value) { | ||
// Is this the static call? | ||
cls.info.decl(nme.TRAIT_CONSTRUCTOR).symbol |
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 think this is incorrect but haven't been able to figure out the correct call, any suggestions?
package hello | ||
|
||
// Minimal reproduction | ||
object Integral { |
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'm using this for testing but it probably should be removed before merging
I'm trying to get
RangesTests
to run on scala.js but I by default get a Linking errorAfter some discussions in gitter I managed to change it to call the trait constructor but there is an extra step of making the call static and I haven't been able to find it. At the moment my error is as below with a minimal test code to reproduce it
I've discussed this with @sjrd in Gitter but haven't found a solution. Hence I'm sending this draft PR to get feedback