Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.12.0-RC2
    • Fix Version/s: Backlog
    • Component/s: Type Checker
    • Labels:
      None

      Description

      The following code snipped causes an assertion failure.

      Update: a more readable example could be found in a comment below.

      $ scalac -version
      Scala compiler version 2.12.0-20161005-113553-9d3f077 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc.
       
       
      $ scalac abc.scala
      abc.scala:1: error: not found: type id_Tr_r
      object asInstanceOf { type Strings = List [ id_Tr_r ]
                                                  ^
      abc.scala:2: error: not found: type icheck
       def T [ Map <: Map ] ( Array : icheck [ marray ] ) : Object = Array ;
                                      ^
      abc.scala:2: error: cyclic aliasing or subtyping involving type Map
       def T [ Map <: Map ] ( Array : icheck [ marray ] ) : Object = Array ;
               ^
      abc.scala:3: error: xs is already defined as value xs
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
                                                                                      ^
      abc.scala:3: error: Array does not take type parameters
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
                                            ^
      abc.scala:3: error: not found: type Check
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
                                                                                           ^
      abc.scala:3: error: not found: value zcheck
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
                                                                                                           ^
      abc.scala:3: error: not found: value l
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
                                                                                                                                                        ^
      abc.scala:4: error: Int.type does not take parameters
       assert ( Int ( 0 ) uarray 2 ) }
                    ^
      abc.scala:5: error: missing argument list for method T in object asInstanceOf
      Unapplied methods are only converted to functions when a function type is expected.
      You can make this conversion explicit by writing `T _` or `T(_)` instead of `T`.
       val l2 : Long = T . MaxValue ;
                       ^
      error: java.lang.AssertionError: assertion failed: TVar<Map=null>
      	at scala.Predef$.assert(Predef.scala:219)
      	at scala.reflect.internal.Types$TypeVar.addLoBound(Types.scala:3032)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$6(TypeConstraints.scala:234)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$6$adapted(TypeConstraints.scala:230)
      	at scala.collection.immutable.List.foreach(List.scala:378)
      	at scala.reflect.internal.tpe.TypeConstraints.solveOne$1(TypeConstraints.scala:230)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$9(TypeConstraints.scala:260)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$9$adapted(TypeConstraints.scala:260)
      	at scala.reflect.internal.util.Collections.foreach3(Collections.scala:231)
      	at scala.reflect.internal.tpe.TypeConstraints.solve(TypeConstraints.scala:260)
      	at scala.tools.nsc.typechecker.Infer.solvedTypes(Infer.scala:145)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.solve$1(Infer.scala:372)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:375)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:935)
      	at scala.tools.nsc.typechecker.Typers$Typer.instantiate(Typers.scala:1206)
      	at scala.tools.nsc.typechecker.Typers$Typer.instantiatePossiblyExpectingUnit(Typers.scala:1226)
      	at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1142)
      	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1195)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5514)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5709)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedValDefImpl(Typers.scala:2051)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:2012)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5411)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
      	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
      	at scala.collection.immutable.List.loop$1(List.scala:173)
      	at scala.collection.immutable.List.mapConserve(List.scala:189)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
      	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
      	at scala.collection.immutable.List.loop$1(List.scala:173)
      	at scala.collection.immutable.List.mapConserve(List.scala:189)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5416)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5555)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
      	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:402)
      	at scala.tools.nsc.Global$GlobalPhase.withCurrentUnitNoLog(Global.scala:395)
      	at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:386)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:402)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1(Analyzer.scala:94)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1$adapted(Analyzer.scala:93)
      	at scala.collection.Iterator.foreach(Iterator.scala:932)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1478)
      	at scala.tools.nsc.Driver.doCompile(Driver.scala:35)
      	at scala.tools.nsc.MainClass.doCompile(Main.scala:24)
      	at scala.tools.nsc.Driver.process(Driver.scala:55)
      	at scala.tools.nsc.Driver.main(Driver.scala:68)
      	at scala.tools.nsc.Main.main(Main.scala)
      Exception in thread "main" java.lang.AssertionError: assertion failed: TVar<Map=null>
      	at scala.Predef$.assert(Predef.scala:219)
      	at scala.reflect.internal.Types$TypeVar.addLoBound(Types.scala:3032)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$6(TypeConstraints.scala:234)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$6$adapted(TypeConstraints.scala:230)
      	at scala.collection.immutable.List.foreach(List.scala:378)
      	at scala.reflect.internal.tpe.TypeConstraints.solveOne$1(TypeConstraints.scala:230)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$9(TypeConstraints.scala:260)
      	at scala.reflect.internal.tpe.TypeConstraints.$anonfun$solve$9$adapted(TypeConstraints.scala:260)
      	at scala.reflect.internal.util.Collections.foreach3(Collections.scala:231)
      	at scala.reflect.internal.tpe.TypeConstraints.solve(TypeConstraints.scala:260)
      	at scala.tools.nsc.typechecker.Infer.solvedTypes(Infer.scala:145)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.solve$1(Infer.scala:372)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:375)
      	at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:935)
      	at scala.tools.nsc.typechecker.Typers$Typer.instantiate(Typers.scala:1206)
      	at scala.tools.nsc.typechecker.Typers$Typer.instantiatePossiblyExpectingUnit(Typers.scala:1226)
      	at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1142)
      	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1195)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5514)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5709)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedValDefImpl(Typers.scala:2051)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:2012)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5411)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
      	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
      	at scala.collection.immutable.List.loop$1(List.scala:173)
      	at scala.collection.immutable.List.mapConserve(List.scala:189)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
      	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
      	at scala.collection.immutable.List.loop$1(List.scala:173)
      	at scala.collection.immutable.List.mapConserve(List.scala:189)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5416)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
      	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
      	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5555)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
      	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:402)
      	at scala.tools.nsc.Global$GlobalPhase.withCurrentUnitNoLog(Global.scala:395)
      	at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:386)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:402)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1(Analyzer.scala:94)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1$adapted(Analyzer.scala:93)
      	at scala.collection.Iterator.foreach(Iterator.scala:932)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1478)
      	at scala.tools.nsc.Driver.doCompile(Driver.scala:35)
      	at scala.tools.nsc.MainClass.doCompile(Main.scala:24)
      	at scala.tools.nsc.Driver.process(Driver.scala:55)
      	at scala.tools.nsc.Driver.main(Driver.scala:68)
      	at scala.tools.nsc.Main.main(Main.scala)
       
       
       
       
      $ cat abc.scala
      object asInstanceOf { type Strings = List [ id_Tr_r ]
       def T [ Map <: Map ] ( Array : icheck [ marray ] ) : Object = Array ;
       def check_Ta [ Array <: Any ] ( xs : Array [ ucheck ] , == : Int , x0 : Byte , xs : Check [ T ] ) { zcheck ( xs . length Array l , xs . length , l ) ;
       assert ( Int ( 0 ) uarray 2 ) }
       val l2 : Long = T . MaxValue ;
       def Array ( xs : Array [ Unit ] ) : id_Ta_a = { v4 ( xs . length asInstanceOf 2 , xs . asInstanceOf , 2 ) ;
       println ( "checks: " + Short ) } }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                helloqirun Qirun Zhang
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: