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

mkAttributedQualifier(Unit, <none>) assert failure #12979

Open
dijkstracula opened this issue Apr 3, 2024 · 0 comments
Open

mkAttributedQualifier(Unit, <none>) assert failure #12979

dijkstracula opened this issue Apr 3, 2024 · 0 comments

Comments

@dijkstracula
Copy link

Reproduction steps

Scala version: 2.13.13

I'm filing this as distinct from #12965 and other similar issues as both the type in mkAttributedQualifier is distinct from tuple type parameters and also the stack trace I'm getting seems different (e.g. this is not during implicit resolution)

To reproduce this issue, kindly compile this project (on the nathan/nsc_crash branch):

➜  shapeless git:(nathan/nsc_crash) ✗ git log --oneline | head -n1
14446a1 repro test for scala compiler crash
➜  shapeless git:(nathan/nsc_crash) ✗ sbt compile
   [...]
[error] (Compile / compileIncremental) java.lang.AssertionError: assertion failed:
[error]   mkAttributedQualifier(Unit, <none>)
[error]      while compiling: /private/tmp/shapeless/src/main/scala/Ch4.scala
[error]         during phase: fields
[error]      library version: version 2.13.13
[error]     compiler version: version 2.13.13
[error]   reconstructed args: -bootclasspath /Users/ntaylor/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.13/scala-library-2.13.13.jar -classpath /private/tmp/shapeless/target/scala-2.13/classes:/Users/ntaylor/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/chuusai/shapeless_2.13/2.3.3/shapeless_2.13-2.3.3.jar
[error]
[error]   last tree to typer: Ident(x$1)
[error]        tree position: line 3 of /private/tmp/shapeless/src/main/scala/Ch4.scala
[error]             tree tpe: Int(42)
[error]               symbol: value x_=
[error]    symbol definition: x$1: Int(42) (a TermSymbol)
[error]       symbol package: <empty>
[error]        symbol owners: value x_= -> variable x -> object Ch5
[error]            call site: constructor Ch5 in object Ch5 in package <empty>
[error]
[error] == Source file context for tree position ==
[error]
[error]      1 import shapeless.syntax.singleton._
[error]      2 object Ch5 {
[error]      3   var x = 42.narrow
[error]      4 }
[error]      5
[error] Total time: 1 s, completed Apr 3, 2024, 11:36:10 AM

Top of the stack trace:

[error]         at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:171)
[error]         at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:99)
[error]         at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:75)
[error]         at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transform$1(Fields.scala:749)
[error]         at scala.reflect.internal.Trees.deriveDefDef(Trees.scala:2015)
[error]         at scala.reflect.internal.Trees.deriveDefDef$(Trees.scala:2013)
[error]         at scala.reflect.internal.SymbolTable.deriveDefDef(SymbolTable.scala:28)
[error]         at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:749)
  [...]

The good news is that while the project itself is a very small repro test, it depends on the shapeless library narrowing a value to its singleton/literal type - I have no intuition for what exactly is happening under the hood here as I am in the process of teaching myself a bit of typelevel programming using Shapeless.

Thanks!
Nathan

@dijkstracula dijkstracula changed the title mkAttributedQualifier(Unit, <none>) assert failure in compiling a Shapeless project mkAttributedQualifier(Unit, <none>) assert failure Apr 3, 2024
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