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
spec requires type checking of for-comprehension to consider refutability #1336
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1336?orig=1 |
Geoffrey Alan Washburn (washburn) said: for ( (a,b) <- this ) becomes for ( (a,b) <- this.filter( case (a,b) => true; case _ => false } ) And if you indeed look at the AST following typechecking, this is indeed the case. However, sometime during the superaccessors or refchecks phase, |
@TiarkRompf said: |
@michael-nischt said: The translation scheme is as follows. In a first step, every generator A pattern p is irrefutable for a 3. p is a constructor pattern Isn't Everything else I would consider a performance bug as the following would copy the array by calling its filter method: val pairs : Array[(Int,Int)] = ...
for((first,second) <- pairs) printf("First: %4d\t Second: %4d\n", first, second) |
@paulp said: It's not obvious to me what is the best way to fix it, because the desugaring is done so early I don't think you can tell yet if a pattern other than a variable pattern is irrefutable. |
1 similar comment
@paulp said: It's not obvious to me what is the best way to fix it, because the desugaring is done so early I don't think you can tell yet if a pattern other than a variable pattern is irrefutable. |
@paulp said: |
@paulp said: |
@retronym said: |
@gkossakowski said: |
@retronym said: |
@adriaanm said: |
Paul Draper (draperp) said (edited on Sep 18, 2015 7:03:43 PM UTC): Scala 2.11.5 has been released. Also, this should be linked to #5589 (which is perhaps a even more common occurrence of this bug). |
The following only compiles with the 'filter' method, however it is never called:
The text was updated successfully, but these errors were encountered: