We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While compiling something like:
class Test { def test(s: String) = s match { case "Hello" => 1 case _ => 2 } }
after PatternMatcher, we get a tree of the form:
PatternMatcher
class Test { def test(s: String): Int = matchResult1[Int]: { case val x1: String = s if "Hello".==(x1) then return[matchResult1] 1 else () return[matchResult1] 2 return[matchResult1] throw new MatchError(x1) } }
It seems unnecessary to generate the tree return[matchResult1] throw new MatchError(x1).
return[matchResult1] throw new MatchError(x1)
Before the labelled block PR:
class Test { def test(s: String): Int = { case val x1: String(s) = s if "Hello".==(x1) then 1 else 2 } }
Also unnecessary bytecode seems to be generated:
Compiled from "Test.scala" public class Test { public int test(java.lang.String); Code: 0: aload_1 1: astore_2 2: ldc #15 // String Hello 4: aload_2 5: invokevirtual #19 // Method java/lang/Object.equals:(Ljava/lang/Object;)Z 8: ifeq 18 11: iconst_1 12: goto 34 15: nop 16: nop 17: athrow 18: iconst_2 19: goto 34 22: nop 23: nop 24: nop 25: nop 26: nop 27: nop 28: nop 29: nop 30: nop 31: nop 32: nop 33: athrow 34: ireturn
Compiled from "Test.scala" public class Test { public int test(java.lang.String); Code: 0: aload_1 1: astore_2 2: ldc #15 // String Hello 4: aload_2 5: invokevirtual #19 // Method java/lang/Object.equals:(Ljava/lang/Object;)Z 8: ifeq 15 11: iconst_1 12: goto 16 15: iconst_2 16: ireturn }
The text was updated successfully, but these errors were encountered:
e2eadf9
sjrd
No branches or pull requests
While compiling something like:
after
PatternMatcher
, we get a tree of the form:It seems unnecessary to generate the tree
return[matchResult1] throw new MatchError(x1)
.Before the labelled block PR:
Also unnecessary bytecode seems to be generated:
Before the labelled block PR:
The text was updated successfully, but these errors were encountered: