Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-6563

AssertionError with combo of by-name, default args, multiple parameter lists, undefined function

    Details

      Description

      This is a regression.

      Reproduce code (just compile it):

      class A{
        def b(c: => Unit){}
        b{
          e("f")
          new G()(){}
       }
      }
      class G(h:String="i")()
      

      Expected result (as in 2.9.1):

      Bug.scala:4: error: not found: value e
          e("f")
          ^
      one error found
      

      Actual result:

      error:
           while compiling: Bug.scala
              during phase: typer
           library version: version 2.10.0-RC1
          compiler version: version 2.10.0-RC1
        reconstructed args:
       
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners:
            context owners: constructor $anon -> anonymous class $anon -> value <local A> -> class A -> package <empty>
       
      == Enclosing template or block ==
       
      Apply( // def <init>(h: String)(): G in class G, tree.tpe=<error>
        Apply( // def <init>(h: String)(): G in class G
          $anon.super."<init>" // def <init>(h: String)(): G in class G, tree.tpe=(h: String)()G
          Nil
        )
        Nil
      )
       
      == Expanded type of tree ==
       
      TypeRef(TypeSymbol(final abstract class Unit extends AnyVal))
       
      uncaught exception during compilation: java.lang.AssertionError
      error: java.lang.AssertionError: assertion failed:
           while compiling: Bug.scala
              during phase: typer
           library version: version 2.10.0-RC1
          compiler version: version 2.10.0-RC1
        reconstructed args:
       
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners:
            context owners: constructor $anon -> anonymous class $anon -> value <local A> -> class A -> package <empty>
       
      == Enclosing template or block ==
       
      Apply( // def <init>(h: String)(): G in class G, tree.tpe=<error>
        Apply( // def <init>(h: String)(): G in class G
          $anon.super."<init>" // def <init>(h: String)(): G in class G, tree.tpe=(h: String)()G
          Nil
        )
        Nil
      )
       
      == Expanded type of tree ==
       
      TypeRef(TypeSymbol(final abstract class Unit extends AnyVal))
       
      mismatch anonymous class $anon List(String) List()
              at scala.Predef$.assert(Predef.scala:179)
              at scala.tools.nsc.Global.assert(Global.scala:238)
              at scala.tools.nsc.typechecker.Typers$Typer.decompose$1(Typers.scala:1947)
              at scala.tools.nsc.typechecker.Typers$Typer.decompose$1(Typers.scala:1943)
              at scala.tools.nsc.typechecker.Typers$Typer.computeParamAliases(Typers.scala:1954)
              at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2170)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5370)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1856)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:505)
              at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1720)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5384)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2334)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typerWithLocalContext(Typers.scala:497)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2335)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typerWithLocalContext(Typers.scala:497)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer.withCondConstrTyper(Typers.scala:488)
              at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2891)
              at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2897)
              at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3156)
              at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3200)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:721)
              at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4459)
              at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4492)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5365)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1856)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:505)
              at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1720)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5384)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5111)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5388)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5493)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:98)
              at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:461)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
              at scala.collection.Iterator$class.foreach(Iterator.scala:727)
              at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:90)
              at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
              at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
              at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
              at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
              at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
              at scala.tools.nsc.Main$.doCompile(Main.scala:79)
              at scala.tools.nsc.Driver.process(Driver.scala:54)
              at scala.tools.nsc.Driver.main(Driver.scala:67)
              at scala.tools.nsc.Main.main(Main.scala)
       
      Exception in thread "main" java.lang.AssertionError: assertion failed:
           while compiling: Bug.scala
              during phase: typer
           library version: version 2.10.0-RC1
          compiler version: version 2.10.0-RC1
        reconstructed args:
       
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners:
            context owners: constructor $anon -> anonymous class $anon -> value <local A> -> class A -> package <empty>
       
      == Enclosing template or block ==
       
      Apply( // def <init>(h: String)(): G in class G, tree.tpe=<error>
        Apply( // def <init>(h: String)(): G in class G
          $anon.super."<init>" // def <init>(h: String)(): G in class G, tree.tpe=(h: String)()G
          Nil
        )
        Nil
      )
       
      == Expanded type of tree ==
       
      TypeRef(TypeSymbol(final abstract class Unit extends AnyVal))
       
      mismatch anonymous class $anon List(String) List()
              at scala.Predef$.assert(Predef.scala:179)
              at scala.tools.nsc.Global.assert(Global.scala:238)
              at scala.tools.nsc.typechecker.Typers$Typer.decompose$1(Typers.scala:1947)
              at scala.tools.nsc.typechecker.Typers$Typer.decompose$1(Typers.scala:1943)
              at scala.tools.nsc.typechecker.Typers$Typer.computeParamAliases(Typers.scala:1954)
              at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2170)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5370)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1856)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:505)
              at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1720)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5384)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2334)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typerWithLocalContext(Typers.scala:497)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2335)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$1.apply(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typerWithLocalContext(Typers.scala:497)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5371)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer.withCondConstrTyper(Typers.scala:488)
              at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2864)
              at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2891)
              at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2897)
              at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3156)
              at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3200)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:721)
              at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4406)
              at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4459)
              at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4492)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5365)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1856)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$27.apply(Typers.scala:1721)
              at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:505)
              at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1720)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5384)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2754)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2854)
              at scala.collection.immutable.List.loop$1(List.scala:164)
              at scala.collection.immutable.List.mapConserve(List.scala:180)
              at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2854)
              at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5111)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5388)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5442)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5493)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:98)
              at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:461)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
              at scala.collection.Iterator$class.foreach(Iterator.scala:727)
              at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
              at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:90)
              at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
              at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
              at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
              at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
              at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
              at scala.tools.nsc.Main$.doCompile(Main.scala:79)
              at scala.tools.nsc.Driver.process(Driver.scala:54)
              at scala.tools.nsc.Driver.main(Driver.scala:67)
              at scala.tools.nsc.Main.main(Main.scala)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                vogt Christopher Vogt
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: