-
Notifications
You must be signed in to change notification settings - Fork 3.1k
SI-7852 for GenBCode #3721
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
SI-7852 for GenBCode #3721
Conversation
Avoid null checks for "someLiteral".== and SomeModule.==. This has been implemented in GenICode in scala#2954. Introduces a trait to share code between GenICode and GenBCode. This is just a start, more such refactorings will come quite certainly.
Review by @retronym |
LGTM. Here's a the build failure for the record. |
As a followup, you probably want to find the spots where I've already shared code between the backends, by having one call the other, and move that into the new common trait. |
Right, one could also call |
i think your way is cleaner. I did this most recently in the #3711. Before that:
|
Would it be ok to use composition + imports instead of inheritance for code sharing? final class BCodeICodeCommon(global: Global) {
import global._
// the common code
} and then abstract class GenICode extends SubComponent {
private val bCodeICodeCommon = new BCodeICodeCommon(global)
import bCodeICodeCommon._
} This would help incremental compilation. If you use inheritance and add something to |
Sure, that's fine with me. |
Actually, I realized now that you'll need: final class BCodeICodeCommon[ThisGlobal <: Global](global: ThisGlobal) in order to push through the path-dependent types. |
@gkossakowski ptal |
@@ -30,6 +29,9 @@ abstract class GenICode extends SubComponent { | |||
} | |||
import platform.isMaybeBoxed | |||
|
|||
private val bCodeICodeCommon: jvm.BCodeICodeCommon[GenICode.this.global.type] = new jvm.BCodeICodeCommon(global) |
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.
Isn't global.type
enough?
done, thanks |
LGTM |
Avoid null checks for "someLiteral".== and SomeModule.==. This has
been implemented in GenICode in #2954.
Introduces a trait to share code between GenICode and GenBCode. This
is just a start, more such refactorings will come quite certainly.
Test already exists. The new
scala-nightly-genbcode-2.1X.x
nightly buildruns all tests on the new backend (that's how the difference was found).