Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0-M2
    • Fix Version/s: Scala 2.10.0-M3
    • Component/s: None
    • Labels:
      None

      Description

      trait Base {
        type Rep[T]
      }
      
      trait Expressions {
        abstract class Exp[T]
        case class Sym[T](n: Int) extends Exp[T]
        abstract class Def[T]
        def findOrCreateDefinition[T](rhs: Def[T]): Sym[T]
        implicit def toExp[T:Manifest](d: Def[T]): Exp[T] = findOrCreateDefinition(d)
      }
      
      trait BaseExp extends Base with Expressions {
        type Rep[T] = Exp[T]
      
        def findOrCreateDefinition[T](rhs: Def[T]): Sym[T] = null // stub
      }
      
      trait NumericOps extends Base {
        def plus[T](x: Rep[T], y: Rep[T]): Rep[T]
      }
      
      trait NumericOpsExp extends BaseExp {
        case class Plus[T:Numeric](x: Rep[T], y: Rep[T])
          extends Def[T]
      
        def plus[T: Numeric](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x,y)  
      
      }
        
      

      crashes with

      
      Exception in thread "main" java.lang.NullPointerException
      	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1097)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4554)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adaptToImplicitMethod$1$1$$anonfun$apply$29.apply(Typers.scala:790)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adaptToImplicitMethod$1$1$$anonfun$apply$29.apply(Typers.scala:787)
      	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:701)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adaptToImplicitMethod$1$1.apply(Typers.scala:787)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adaptToImplicitMethod$1$1.apply(Typers.scala:785)
      	at scala.tools.nsc.typechecker.Typers$Typer.withCondConstrTyper(Typers.scala:471)
      	at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:785)
      	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:997)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4554)
      	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4703)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1861)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4214)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4545)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2220)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37$$anonfun$38.apply(Typers.scala:2317)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37$$anonfun$38.apply(Typers.scala:2317)
      	at scala.collection.immutable.List.loop$1(List.scala:151)
      	at scala.collection.immutable.List.mapConserve(List.scala:167)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37.apply(Typers.scala:2317)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37.apply(Typers.scala:2316)
      	at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:497)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2316)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1611)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$26.apply(Typers.scala:1485)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$26.apply(Typers.scala:1485)
      	at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:488)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1484)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4205)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4545)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2220)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37$$anonfun$38.apply(Typers.scala:2317)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37$$anonfun$38.apply(Typers.scala:2317)
      	at scala.collection.immutable.List.loop$1(List.scala:151)
      	at scala.collection.immutable.List.mapConserve(List.scala:167)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37.apply(Typers.scala:2317)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$37.apply(Typers.scala:2316)
      	at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:497)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2316)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4201)
      

        Issue Links

          Activity

          Hide
          Hubert Plociniczak added a comment -

          It seems that it is a bad interaction with ResetAttrs which side-effects on the tree.

          Show
          Hubert Plociniczak added a comment - It seems that it is a bad interaction with ResetAttrs which side-effects on the tree.
          Hide
          Hubert Plociniczak added a comment -

          Fixed in ae5ff6628bb74c16d871a2ada06.

          Show
          Hubert Plociniczak added a comment - Fixed in ae5ff6628bb74c16d871a2ada06.

            People

            • Assignee:
              Hubert Plociniczak
              Reporter:
              Hubert Plociniczak
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development