We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
3.1.3 and also 2.13.8
package example object Main { def m(x: Int): Unit = { x match { case y => println(y) // breakpoint here, line 7 println(y) } } def main(args: Array[String]): Unit = { m(1) } }
The program pauses on line 7 but the local variable y is not defined.
y
The local variable y should be defined
The result of decompiling m from its class file is:
m
public void m(int); Code: 0: iload_1 1: istore_2 2: iload_2 3: istore_3 4: getstatic #33 // Field scala/Predef$.MODULE$:Lscala/Predef$; 7: iload_3 8: invokestatic #39 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; 11: invokevirtual #43 // Method scala/Predef$.println:(Ljava/lang/Object;)V 14: getstatic #33 // Field scala/Predef$.MODULE$:Lscala/Predef$; 17: iload_3 18: invokestatic #39 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; 21: invokevirtual #43 // Method scala/Predef$.println:(Ljava/lang/Object;)V 24: goto 27 27: return LineNumberTable: line 4: 0 line 5: 0 line 7: 2 line 8: 14 LocalVariableTable: Start Length Slot Name Signature 4 23 3 y I 0 28 0 this Lexample/Main$; 0 28 1 x I
Here the line number 7 is associated with byte code 2 which is too early, the local variable y on slot 3 has not yet been initialized.
I believe the line number 7 should be associated with the byte code 4.
If the body of the case contains only one instruction, then the debug line number table is correct:
def m(x: Int): Unit = { x match { case y => println(y) } }
public void m(int); Code: 0: iload_1 1: istore_2 2: iload_2 3: istore_3 4: getstatic #33 // Field scala/Predef$.MODULE$:Lscala/Predef$; 7: iload_3 8: invokestatic #39 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; 11: invokevirtual #43 // Method scala/Predef$.println:(Ljava/lang/Object;)V 14: goto 17 17: return LineNumberTable: line 4: 0 line 5: 0 line 6: 2 line 7: 4 LocalVariableTable: Start Length Slot Name Signature 4 13 3 y I 0 18 0 this Lexample/Main$; 0 18 1 x I
The text was updated successfully, but these errors were encountered:
Florian3k
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.1.3 and also 2.13.8
Minimized code
Output
The program pauses on line 7 but the local variable
y
is not defined.Expectation
The local variable
y
should be definedDetails
An incorrect line number table
The result of decompiling
m
from its class file is:Here the line number 7 is associated with byte code 2 which is too early, the local variable
y
on slot 3 has not yet been initialized.I believe the line number 7 should be associated with the byte code 4.
A correct line number table
If the body of the case contains only one instruction, then the debug line number table is correct:
The text was updated successfully, but these errors were encountered: