Skip to content
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

Translated switches are needlessly lubbed #7611

Closed
scabug opened this issue Jun 26, 2013 · 3 comments
Closed

Translated switches are needlessly lubbed #7611

scabug opened this issue Jun 26, 2013 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jun 26, 2013

Usually, the pattern match translation converts a Match
to code consisting of if/else and label jumps.

However, if it able to express the result as a table switch,
it emits another Match node.

The pattern matcher phase's TypingTransformer then typechecks
that without an expected type, which needlessly lubs the
cases.

Suggested fix:

https://github.com/retronym/scala/compare/topic;match-pt?expand=1

Will it Blend?

https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/926/console

@scabug
Copy link
Author

scabug commented Jun 26, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7611?orig=1
Reporter: @retronym
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Jun 26, 2013

@scabug
Copy link
Author

scabug commented Jun 26, 2013

@retronym said:
Still needs a little work:

Test suite finished with 3 cases failing:
fail - continuations-run/match2.scala  [compilation failed]% scalac match2.scala
match2.scala:9: error: error during expansion of this match (this is a scalac bug).
The underlying error was: type mismatch;
 found   : (String, String) @scala.util.continuations.cpsSynth @scala.util.continuations.cpsParam[String,String]
 required: (String, String)

    val (a, b) = shift { k: (((String,String)) => String) => k("A","B") }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants