Scala Programming Language
  1. Scala Programming Language
  2. SI-6597

typer fails assertion on implicit AnyVal case class with companion object

    Details

      Description

      object Test

      { trait T extends Any implicit case class A(value: Int) extends AnyVal with T object A }

      Gives

      [error] uncaught exception during compilation: java.lang.AssertionError
      [trace] Stack trace suppressed: run 'last compile:compile' for the full output.
      [error] (compile:compile) java.lang.AssertionError: assertion failed: List(object A, object A)
      [error] Total time: 0 s, completed 31-Oct-2012 12:31:10

      Instead of the expected error about combining implicit and case.

        Activity

        Hide
        Adriaan Moors added a comment -
        java.lang.AssertionError: assertion failed: List(object A, object A)
        	at scala.Predef$.assert(Predef.scala:179)
        	at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1640)
        	at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:2926)
        	at scala.reflect.internal.Symbols$ClassSymbol.companionSymbol(Symbols.scala:2930)
        	at scala.tools.nsc.typechecker.Namers$class.companionSymbolOf(Namers.scala:1579)
        	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.companionSymbolOf(ReplGlobal.scala:24)
        	at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:884)
        	at scala.tools.nsc.typechecker.Namers$Namer.classSig(Namers.scala:907)
        	at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1289)
        	at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1347)
        	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:709)
        	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
        	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
        	at scala.tools.nsc.typechecker.Namers$Namer$LogTransitions.apply(Namers.scala:1376)
        	at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1385)
        	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:708)
        	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:707)
        	at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1496)
        	at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1504)
        	at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1494)
        	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1217)
        	at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1349)
        	at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:230)
        	at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:55)
        	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1854)
        	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1854)
        	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1792)
        	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1789)
        	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        	at scala.collection.immutable.List.foreach(List.scala:309)
        	at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        	at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1854)
        
        Show
        Adriaan Moors added a comment - java.lang.AssertionError: assertion failed: List(object A, object A) at scala.Predef$.assert(Predef.scala:179) at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1640) at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:2926) at scala.reflect.internal.Symbols$ClassSymbol.companionSymbol(Symbols.scala:2930) at scala.tools.nsc.typechecker.Namers$class.companionSymbolOf(Namers.scala:1579) at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.companionSymbolOf(ReplGlobal.scala:24) at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:884) at scala.tools.nsc.typechecker.Namers$Namer.classSig(Namers.scala:907) at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1289) at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1347) at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:709) at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708) at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708) at scala.tools.nsc.typechecker.Namers$Namer$LogTransitions.apply(Namers.scala:1376) at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1385) at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:708) at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:707) at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1496) at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1504) at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1494) at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1217) at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1349) at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:230) at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:55) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1854) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1854) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1792) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1789) at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251) at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251) at scala.collection.immutable.List.foreach(List.scala:309) at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251) at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105) at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1854)
        Show
        Paul Phillips added a comment - https://github.com/scala/scala/pull/1550
        Hide
        Adriaan Moors added a comment -

        it wasn't a value class issue, for the record

        Show
        Adriaan Moors added a comment - it wasn't a value class issue, for the record
        Hide
        Alec Zorab added a comment -

        Indeed. Label removed.

        Show
        Alec Zorab added a comment - Indeed. Label removed.
        Hide
        Adriaan Moors added a comment -
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/1551 for 2.10.x
        Hide
        Jason Zaugg added a comment -
        Show
        Jason Zaugg added a comment - Merged: https://github.com/scala/scala/commit/99991831

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Alec Zorab
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development