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

"java.lang.AssertionError: ... mkAttributedQualifier(Unit, <none>)" on 1.narrow #674

Open
kevinmeredith opened this issue Jan 7, 2017 · 9 comments
Assignees
Labels

Comments

@kevinmeredith
Copy link

kevinmeredith commented Jan 7, 2017

Hi -

Given:

$cat build.sbt 
scalaVersion := "2.12.1"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "2.3.2"
)

The following compiler crash occurs within sbt console:

import shapeless.syntax.singleton._

scala> var x = 1.narrow
java.lang.AssertionError: assertion failed: mkAttributedQualifier(Unit, <none>)
	at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:86)
	at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:62)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transform$1(Fields.scala:722)
	at scala.reflect.internal.Trees.deriveDefDef(Trees.scala:1804)
	at scala.reflect.internal.Trees.deriveDefDef$(Trees.scala:1802)
	at scala.reflect.internal.SymbolTable.deriveDefDef(SymbolTable.scala:16)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:722)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformTermsAtExprOwner(Fields.scala:763)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$3(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1408)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
	at scala.reflect.internal.Trees.$anonfun$itransform$4(Trees.scala:1412)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1411)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:746)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transformStats$4(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:776)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transformStats(Fields.scala:540)
	at scala.reflect.internal.Trees.$anonfun$itransform$7(Trees.scala:1430)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
	at scala.reflect.internal.Trees.itransform(Trees.scala:1430)
	at scala.reflect.internal.Trees.itransform$(Trees.scala:1340)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.super$transform(TypingTransformers.scala:40)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$2(TypingTransformers.scala:42)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:25)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:755)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.transform(Fields.scala:540)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:140)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:416)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:409)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1(Global.scala:380)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1$adapted(Global.scala:380)
	at scala.collection.Iterator.foreach(Iterator.scala:929)
	at scala.collection.Iterator.foreach$(Iterator.scala:929)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1406)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:380)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1418)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1403)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1398)
	at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:430)
	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:801)
	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:759)
	at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:948)
	at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:943)
	at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:599)
	at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:588)
	at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:560)
	at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825)
	at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:684)
	at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:402)
	at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:423)
	at scala.tools.nsc.interpreter.ILoop.$anonfun$process$1(ILoop.scala:993)
	at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:892)
	at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:1004)
	at xsbt.ConsoleInterface.run(ConsoleInterface.scala:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
	at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:82)
	at sbt.Console.sbt$Console$$console0$1(Console.scala:22)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:23)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
	at sbt.Logger$$anon$4.apply(Logger.scala:84)
	at sbt.TrapExit$App.run(TrapExit.scala:248)
	at java.lang.Thread.run(Thread.java:745)

I'm not sure if creating a scalac bug would've been more appropriate. However, I decided to post the bug here first.

@milessabin
Copy link
Owner

I think here is the right place to post it. Can you confirm that this bug is REPL-only?

@milessabin milessabin added the Bug label Jan 7, 2017
@kevinmeredith
Copy link
Author

Yes, it only occurs in the REPL:

$cat build.sbt 
scalaVersion := "2.12.1"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "2.3.2"
)

$cat src/main/scala/net/NarrowReplBug.scala 
package net

import shapeless.syntax.singleton._

object NarrowReplBug {

  def main(args: Array[String]): Unit = {

    println(1.narrow)

  }

}
$sbt run
[info] Set current project to shapeless-sandbox (in build file:/Users/kevinmeredith/Workspace/shapeless-sandbox/)
[info] Compiling 1 Scala source to /Users/kevinmeredith/Workspace/shapeless-sandbox/target/scala-2.12/classes...
[info] Running net.NarrowReplBug 
1
[success] Total time: 4 s, completed Jan 7, 2017 7:01:43 AM

@hamishdickson
Copy link
Contributor

hamishdickson commented Jan 26, 2017

Hi, just stumbled over this myself while going through Dave Gurnell's book and while I'm not sure where to start looking for a fix, I can add some more details

After some playing this is reproducible outside of the REPL

$ cat build.sbt
scalaVersion := "2.12.1"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "2.3.2"
)

$ cat NarrowBug.scala
package net

import shapeless.syntax.singleton._

object NarrowBug {
  var one = 1.narrow
}

$ sbt compile                                         Thu 26 Jan 2017 11:27:43 GMT
[info] Loading global plugins from /Users/hamishdickson/.sbt/0.13/plugins
[info] Set current project to narrow (in build file:/Users/hamishdickson/Desktop/narrow/)
[info] Compiling 1 Scala source to /Users/hamishdickson/Desktop/narrow/target/scala-2.12/classes...
java.lang.AssertionError: assertion failed: mkAttributedQualifier(Unit, <none>)
	at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:86)
	at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:62)
	at scala.tools.nsc.transform.Fields$FieldsTransformer.$anonfun$transform$1(Fields.scala:722)

etc

This is the same error as @kevinmeredith gets

Weirdly, this only seems to happen when one is a var (ie it compiles fine if one is a val) and also it seems one must be outside of a function, ie this compiles:

$ cat CompilesFine.scala
package net

import shapeless.syntax.singleton._

object CompilesFine {
  def foo: Unit = {
    var one = 1.narrow
  }
}

@teldosas
Copy link
Contributor

It must be a scalac cause the error appears only for scala version 2.12.1. There is no error for scala 2.11.8 and 2.10.6.

@teldosas
Copy link
Contributor

And I think the found the part of scala to blame. Here it is.

If we comment out this part the error disappears. The TODO: is interesting it says to "defer replacing ConstantTyped tree by the corresponding constant until erasure", which is exactly the reason that the assertion fails

But I don't know what breaks after we comment this out.

Should we open a scala issue? @milessabin

@lshoo
Copy link

lshoo commented Sep 12, 2017

In the idea 2017.2.3 has the different error:
Internal error: shapeless_guice.A$A216
org.jetbrains.jps.incremental.scala.remote.ClientEventProcessor.process(ClientEventProcessor.scala:22)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$class.handle(RemoteResourceOwner.scala:47)
org.jetbrains.plugins.scala.compiler.RemoteServerRunner.handle(RemoteServerRunner.scala:14)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1$$anonfun$apply$3.apply(RemoteResourceOwner.scala:30)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1$$anonfun$apply$3.apply(RemoteResourceOwner.scala:29)
org.jetbrains.jps.incremental.scala.package$.using(package.scala:21)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1.apply(RemoteResourceOwner.scala:29)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1.apply(RemoteResourceOwner.scala:25)
org.jetbrains.jps.incremental.scala.package$.using(package.scala:21)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1.apply(RemoteResourceOwner.scala:25)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1.apply(RemoteResourceOwner.scala:24)
org.jetbrains.jps.incremental.scala.package$.using(package.scala:21)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$class.send(RemoteResourceOwner.scala:24)
org.jetbrains.plugins.scala.compiler.RemoteServerRunner.send(RemoteServerRunner.scala:14)
org.jetbrains.plugins.scala.compiler.RemoteServerRunner$$anon$1$$anonfun$run$1.apply$mcVI$sp(RemoteServerRunner.scala:33)
scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
org.jetbrains.plugins.scala.compiler.RemoteServerRunner$$anon$1.run(RemoteServerRunner.scala:30)
org.jetbrains.plugins.scala.worksheet.server.RemoteServerConnector.compileAndRun(RemoteServerConnector.scala:107)
org.jetbrains.plugins.scala.worksheet.processor.WorksheetCompiler$$anon$3.run(WorksheetCompiler.scala:69)
com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:197)
com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:718)
com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:170)
com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:548)
com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:493)
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:342)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

@milessabin
Copy link
Owner

@lshoo how does that stack trace relate to this ticket?

@milessabin milessabin self-assigned this Sep 13, 2017
@bpawan
Copy link

bpawan commented Feb 16, 2018

Is there any fix available for this issue or maybe some workarounds?

It can be easily reproduced as follows:

curl -s https://raw.githubusercontent.com/milessabin/shapeless/master/scripts/try-shapeless.sh | bash

import shapeless.syntax.singleton._

var x = 42.narrow

@soronpo
Copy link

soronpo commented Apr 7, 2018

I stumbled on the same error in my own library (not using shapeless) and not in REPL. I think this is a scalac issue. EDIT: further exploring the log, maybe not the same

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

7 participants