- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
"lub/glb of incompatible types" regression in 2.8.1
Wed, 2010-11-10, 20:05
After updating my company's project to Scala 2.8.1, the compiler
crashes with the message "lub/glb of incompatible types:
[K,V]scala.collection.Map[K,V] and Tuple2". It doesn't give a
backtrace by default, but I've built a version of the compiler which
does -- the stack trace is rather long, but I've included it at the
end of this message on the off chance it'd be helpful.
I don't yet know if it's the same as #2782. Mainly I'm asking for
hints on localizing where in my program the compiler is working when
it crashes, so I have some hope of reducing it to a reasonable repro
case. Right now it's lost deep in a 100kline mixed scala/java project
and I have no idea where to even begin trying to pinpoint the source
of the exception.
Running scalac with -verbose, the last thing it wants to report before
crashing is loading a class from BDB, but I've successfully compiled
all the parts of the code that use BDB directly separately from the
rest of the project without failures (though it did end with assertion
failures until I got all of the necessary source files on the
command-line).
Here's the stack trace:
scala.tools.nsc.symtab.Types$NoCommonType: lub/glb of incompatible types: [K,V]scala.collection.Map[K,V] and Tuple2
at scala.tools.nsc.symtab.Types$$anonfun$matchingBounds$1.apply(Types.scala:5318)
at scala.tools.nsc.symtab.Types$$anonfun$matchingBounds$1.apply(Types.scala:5314)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.List.map(List.scala:45)
at scala.tools.nsc.symtab.Types$class.matchingBounds(Types.scala:5314)
at scala.tools.nsc.symtab.Types$class.glb0$1(Types.scala:5110)
at scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$glb(Types.scala:5206)
at scala.tools.nsc.symtab.Types$class.solveOne$1(Types.scala:4789)
at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4800)
at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4799)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.symtab.Types$class.solve(Types.scala:4799)
at scala.tools.nsc.symtab.SymbolTable.solve(SymbolTable.scala:13)
at scala.tools.nsc.typechecker.Infer$class.solvedTypes(Infer.scala:143)
at scala.tools.nsc.Global$analyzer$.solvedTypes(Global.scala:301)
at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:458)
at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:1095)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:832)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:826)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:464)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit(Implicits.scala:359)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.tryImplicit$1(Implicits.scala:623)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:631)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:628)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.addAppInfos$1(Implicits.scala:628)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.applicableInfos(Implicits.scala:645)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:669)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:902)
at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:54)
at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:301)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:206)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:201)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:201)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:853)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4208)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4265)
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:4341)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1145)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:523)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:521)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1309)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1307)
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:735)
at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:848)
at scala.tools.nsc.symtab.Symbols$Symbol.annotations(Symbols.scala:111)
at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:1370)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$10.apply(Typers.scala:1547)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$10.apply(Typers.scala:1547)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:227)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:227)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:227)
at scala.collection.immutable.List.flatMap(List.scala:45)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1547)
at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1311)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3853)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2128)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at scala.collection.immutable.List.loop$1(List.scala:115)
at scala.collection.immutable.List.mapConserve(List.scala:132)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2196)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3849)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4252)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:85)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:282)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:282)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:80)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:80)
at scala.collection.Iterator$class.foreach(Iterator.scala:631)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:304)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:80)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:741)
at scala.tools.nsc.Global$Run.compile(Global.scala:822)
at scala.tools.nsc.Main$.process(Main.scala:106)
at scala.tools.nsc.Main$.main(Main.scala:121)
at scala.tools.nsc.Main.main(Main.scala)
Thu, 2010-11-11, 01:07
#2
Re: "lub/glb of incompatible types" regression in 2.8.1
On 2010-11-10, Jason Zaugg wrote:
> Spin up the compiler with -Ytyper-debug -Xlog-implicits and report
> back. Throw in a -Xprint:typer for good luck.
Excellent -- this has at least let me narrow it down to which file is
causing the exception. Now it's just a matter of commenting things
out until it goes away, and then extracting that into a repro
(hopefully). Thanks!
Thu, 2010-11-11, 01:37
#3
Re: "lub/glb of incompatible types" regression in 2.8.1
On 2010-11-10, Jason Zaugg wrote:
> Spin up the compiler with -Ytyper-debug -Xlog-implicits and report
> back. Throw in a -Xprint:typer for good luck.
Thanks again for helping out -- it *is* an instance of bug 2782.
Also, my minimized reproduction crashes 2.8.0 also, which suggests
that source file is skating on extremely thin ice already. Now I
don't know why it works at all!
Thu, 2010-11-11, 13:57
#4
Re: Re: "lub/glb of incompatible types" regression in 2.8.1
Could you still produce a test case, and attach it to the existing
ticket? #2782 seems is related to raw types, which can only occur with
Java generics, and I didn't see evidence of these from the exception
you posted.
-jason
On Thu, Nov 11, 2010 at 1:33 AM, Robert Macomber wrote:
> On 2010-11-10, Jason Zaugg wrote:
>> Spin up the compiler with -Ytyper-debug -Xlog-implicits and report
>> back. Throw in a -Xprint:typer for good luck.
>
> Thanks again for helping out -- it *is* an instance of bug 2782.
> Also, my minimized reproduction crashes 2.8.0 also, which suggests
> that source file is skating on extremely thin ice already. Now I
> don't know why it works at all!
Spin up the compiler with -Ytyper-debug -Xlog-implicits and report
back. Throw in a -Xprint:typer for good luck.
It's actually not to hard to hook up a debugger to your compiler, such
that it stops at the point of this crash. Command line flags sometimes
come to the rescue, but the debugger doesn't discriminate, and will
happily help pinpoint problems that aren't illuminated by a
thoughtfully placed logging statement.
Instructions here (slightly out of date, but in essence correct)
http://lampsvn.epfl.ch/trac/scala/ticket/2429#comment:4
-jason
On Wed, Nov 10, 2010 at 8:03 PM, Robert Macomber wrote:
> After updating my company's project to Scala 2.8.1, the compiler
> crashes with the message "lub/glb of incompatible types:
> [K,V]scala.collection.Map[K,V] and Tuple2". It doesn't give a
> backtrace by default, but I've built a version of the compiler which
> does -- the stack trace is rather long, but I've included it at the
> end of this message on the off chance it'd be helpful.
>
> I don't yet know if it's the same as #2782. Mainly I'm asking for
> hints on localizing where in my program the compiler is working when
> it crashes, so I have some hope of reducing it to a reasonable repro
> case. Right now it's lost deep in a 100kline mixed scala/java project
> and I have no idea where to even begin trying to pinpoint the source
> of the exception.
>
> Running scalac with -verbose, the last thing it wants to report before
> crashing is loading a class from BDB, but I've successfully compiled
> all the parts of the code that use BDB directly separately from the
> rest of the project without failures (though it did end with assertion
> failures until I got all of the necessary source files on the
> command-line).
>
> Here's the stack trace:
>
> scala.tools.nsc.symtab.Types$NoCommonType: lub/glb of incompatible types: [K,V]scala.collection.Map[K,V] and Tuple2
> at scala.tools.nsc.symtab.Types$$anonfun$matchingBounds$1.apply(Types.scala:5318)
> at scala.tools.nsc.symtab.Types$$anonfun$matchingBounds$1.apply(Types.scala:5314)
> at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
> at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
> at scala.collection.immutable.List.map(List.scala:45)
> at scala.tools.nsc.symtab.Types$class.matchingBounds(Types.scala:5314)
> at scala.tools.nsc.symtab.Types$class.glb0$1(Types.scala:5110)
> at scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$glb(Types.scala:5206)
> at scala.tools.nsc.symtab.Types$class.solveOne$1(Types.scala:4789)
> at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4800)
> at scala.tools.nsc.symtab.Types$$anonfun$solve$1.apply(Types.scala:4799)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.tools.nsc.symtab.Types$class.solve(Types.scala:4799)
> at scala.tools.nsc.symtab.SymbolTable.solve(SymbolTable.scala:13)
> at scala.tools.nsc.typechecker.Infer$class.solvedTypes(Infer.scala:143)
> at scala.tools.nsc.Global$analyzer$.solvedTypes(Global.scala:301)
> at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:458)
> at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:1095)
> at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:832)
> at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:826)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:464)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit(Implicits.scala:359)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.tryImplicit$1(Implicits.scala:623)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:631)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:628)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.addAppInfos$1(Implicits.scala:628)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.applicableInfos(Implicits.scala:645)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:669)
> at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:902)
> at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:54)
> at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:301)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:206)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:201)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:201)
> at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:853)
> at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4208)
> at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4265)
> at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:4341)
> at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1145)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:523)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:521)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1309)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1307)
> at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:735)
> at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:848)
> at scala.tools.nsc.symtab.Symbols$Symbol.annotations(Symbols.scala:111)
> at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:1370)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$10.apply(Typers.scala:1547)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$10.apply(Typers.scala:1547)
> at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:227)
> at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:227)
> at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
> at scala.collection.immutable.List.foreach(List.scala:45)
> at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:227)
> at scala.collection.immutable.List.flatMap(List.scala:45)
> at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1547)
> at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1311)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3853)
> at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2128)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
> at scala.collection.immutable.List.loop$1(List.scala:115)
> at scala.collection.immutable.List.mapConserve(List.scala:132)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2196)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3849)
> at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
> at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4252)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:85)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:282)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
> at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
> at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:282)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:80)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:80)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:304)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:80)
> at scala.tools.nsc.Global$Run.compileSources(Global.scala:741)
> at scala.tools.nsc.Global$Run.compile(Global.scala:822)
> at scala.tools.nsc.Main$.process(Main.scala:106)
> at scala.tools.nsc.Main$.main(Main.scala:121)
> at scala.tools.nsc.Main.main(Main.scala)
>
>