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

Compiler crash I can't localize #539

Open
erikerlandson opened this issue Nov 29, 2023 · 0 comments
Open

Compiler crash I can't localize #539

erikerlandson opened this issue Nov 29, 2023 · 0 comments

Comments

@erikerlandson
Copy link
Owner

One example of a reproducer:

scala> import coulomb.*, coulomb.syntax.*, coulomb.conversion.*, coulomb.units.si.{*, given}, coulomb.units.si.prefixes.{*, given}, algebra.instances.all.given, coulomb.ops.algebra.all.given, coulomb.policy.standard.given, scala.language.implicitConversions

// works as expected
scala> summon[coulomb.ops.SimplifiedUnit[Meter ^ 2]]
val res0:
  coulomb.ops.SimplifiedUnit.NC[coulomb.units.si.Meter ^ 2,
    coulomb.units.si.Meter ^ 2] = coulomb.ops.SimplifiedUnit$NC@5fb1d61
                                     
// works as expected (converts type literal "2" to 2)                                                                                       
scala> summon[coulomb.ops.SimplifiedUnit[Meter ^ "2"]]
val res1:
  coulomb.ops.SimplifiedUnit.NC[coulomb.units.si.Meter ^ "2",
    coulomb.units.si.Meter ^ 2] = coulomb.ops.SimplifiedUnit$NC@cff51e5
                                                                                          
// this should be a type error but crashes the compiler:                                  
scala> summon[coulomb.ops.SimplifiedUnit[Meter ^ "x"]]
java.lang.AssertionError: assertion failed while typechecking rs$line$4
[error] java.lang.AssertionError: assertion failed
[error] 	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
[error] 	at dotty.tools.dotc.ast.tpd$.TypeApply(tpd.scala:60)
[error] 	at dotty.tools.dotc.ast.tpd$TreeOps$.appliedToTypeTrees$extension(tpd.scala:985)
[error] 	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4255)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant