-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Other pickling difference errors with explicit nulls and unsafe nulls #15097
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
Comments
The issue will be fixed by #15105 |
I can verify you PRs do fix the errors in the minimized code. However, the test For example, the def instructionString(instruction: AbstractInsnNode): String = instruction.getOpcode match {
case -1 => instruction.toString
case op => scala.tools.asm.util.Printer.OPCODES(op)
} At the end of the test, the command is given to reproduce the error:
And I can reproduce the error using the command. But when I extract the error code to a file, I couldn't reproduce the error anymore :( import scala.language.unsafeNulls
object AsmUtils {
def i: Int = ???
val OPCODES: Array[String | Null] = ???
def instructionString(instruction: Object): String = i match {
case -1 => instruction.toString
case op => OPCODES(op)
}
}
Is this because the pickling test may use tasty files from bootstrap compiling? |
It seems the bug is from the order of imports. If the |
There are still some inconsistancy on nullable union in import scala.language.unsafeNulls
class C {
def a(): String | Null = ???
val b: String | Null = ???
def f(x: Int) = x match {
case 0 => b
case _ => a()
}
def g(x: Int) = x match {
case 0 => a()
case _ => b
}
} For example, the code above, Another example is the import scala.language.unsafeNulls
import scala.tools.asm
class BTypes {
def toASMType(a: String) = a match {
case "INT" => asm.Type.INT_TYPE
case "FLOAT" => asm.Type.FLOAT_TYPE
case "MethodBType" => asm.Type.getMethodType(a)
}
} I think the problem is: should we get nullable types returned from Given the semantic of |
I'm not sure if the following would work, but it would be nice if we can make it work: I think computation of A problem is that one of the relaxations that But I'm not sure whether this is feasible or whether it will cause significant new problems. |
Closing this issue since the error is no longer reproducible. |
An error similar to #14947
Minimized code
Output (click arrow to expand)
scalac -Xprint-types -Ytest-pickler -Yexplicit-nulls -color never Stest.scala
This is similar to the
if
error before. Thetry
expression gets different types before and after pickling (String
andString | Null
).Since the tree seems having correct language imports when unpickling (#14962), I guess the bug is from typing?
cc @odersky
The text was updated successfully, but these errors were encountered: