-
Notifications
You must be signed in to change notification settings - Fork 396
Fix #4409: Do not emit abstract methods in non-native JS classes. #4425
New issue
Have a question about this project? Sign up for a free GitHub account to open an iss 8000 ue 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
Fix #4409: Do not emit abstract methods in non-native JS classes. #4425
Conversation
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.
Is this an appropriate way to fix this in 1.5? Throwing the exception would be moved to the ClassDefChecker in the future.
Absolutely. I only have minor comments.
s.tpe.params.tail.zip(sym.tpe.params).forall { | ||
case (sParam, symParam) => | ||
sParam.tpe =:= symParam.tpe | ||
if (isNonNativeJSClass(currentClassSym)) { |
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.
Could we avoid the nesting? (maybe by checking isAbstractMethod
twice or putting it into a lazy val)?
} else { | ||
memberDefs0 | ||
} | ||
|
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.
< 8000 /div>Do this inside readMemberDefs
?
case m @ MethodDef(_, name, _, _, _, None) => | ||
if (!hacks.use14) { | ||
throw new InvalidIRException(m, | ||
"Invalid abstract method in non-native JS class") |
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.
Add a comment referencing #4388 that this should be there but currently can't?
ba11103
to
1cb55c8
Compare
Updated. In addition to addressing the comments, I had to rearrange the way the hack is done not to cause the Scala 2.11 compiler to crash. The upside is that it is easier to see exactly what will disappear when we can move the check to a ClassDefChecker. |
def readMemberDefs(owner: ClassName, ownerKind: ClassKind): List[MemberDef] = | ||
List.fill(readInt())(readMemberDef(owner, ownerKind)) | ||
def readMemberDefs(owner: ClassName, ownerKind: ClassKind): List[MemberDef] = { | ||
val memberDefs0 = List.fill(readInt())(readMemberDef(owner, ownerKind)) |
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.
Not sure the 0
is still necessary. But up to you.
The deser hack is first always enabled, to test backward binary compatibility.
…ses. We condition the deser hack to reading IR with version < 1.5.0. When that hack is not enab 8A14 led and we find an abstract method in a non-native JS class, we immediately throw an exception, since the IR checker would not catch it as an issue.
1cb55c8
to
294efab
Compare
@gzm0 Is this an appropriate way to fix this in 1.5? Throwing the exception would be moved to the
ClassDefChecker
in the future.