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

Value class error when method signature references class type parameter #5591

Closed
scabug opened this issue Mar 21, 2012 · 3 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Mar 21, 2012

Compiling

class Foo[T](val x: Int) extends AnyVal { def xyzzy(t:T) = t } 

object Test {
  new Foo[String](4).xyzzy(null)
}

causes an assertion failure in the compiler

error: 
     while compiling:  ok.scala
       current phase:  erasure
     library version:  version 2.10.0-20120320-074449-d9d46a8bbb
    compiler version:  version 2.10.0-20120320-074449-d9d46a8bbb
  reconstructed args:  

uncaught exception during compilation: java.lang.AssertionError
error: java.lang.AssertionError: assertion failed: 
     while compiling:  ok.scala
       current phase:  refchecks
     library version:  version 2.10.0-20120320-074449-d9d46a8bbb
    compiler version:  version 2.10.0-20120320-074449-d9d46a8bbb
  reconstructed args:  

no extension method found for method xyzzy among Stream(method extension$xyzzy)/Stream(extension$xyzzy, ?)
	at scala.Predef$.assert(Predef.scala:161)
	at scala.tools.nsc.Global.assert(Global.scala:176)
	at scala.tools.nsc.transform.ExtensionMethods$$anonfun$extensionMethod$1.apply(ExtensionMethods.scala:67)
	at scala.tools.nsc.transform.ExtensionMethods$$anonfun$extensionMethod$1.apply(ExtensionMethods.scala:58)
	at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:138)
	at scala.tools.nsc.transform.ExtensionMethods.extensionMethod(ExtensionMethods.scala:58)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$1.preErase(Erasure.scala:1045)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$1.transform(Erasure.scala:1100)
        [snip]

It seems to stem from the argument involving the class' type parameter. I think the matches check around the assertion does not consider the two type parameters to match.

@scabug
Copy link
Author

scabug commented Mar 21, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5591?orig=1
Reporter: Geoff Reedy (geoff)
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Mar 25, 2012

Geoff Reedy (geoff) said:
Guess I should mention here that I've got a pull request open with an apparent fix for this issue (and a test case for it) at scala/scala#302

@scabug
Copy link
Author

scabug commented Aug 7, 2012

@odersky said:
Closed by Geoff's pull request.

@scabug scabug closed this as completed Aug 7, 2012
@scabug scabug added this to the 2.10.0-M2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants