Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling Scalaz causes a scalac exception. #2197

Closed
scabug opened this issue Jul 25, 2009 · 6 comments
Closed

Compiling Scalaz causes a scalac exception. #2197

scabug opened this issue Jul 25, 2009 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 25, 2009

Scalaz from trunk (svn revision 812) will not compile with Scala from trunk (revision 18388), giving the below output. The assertion dates from April 08, so I'd guess it's not the addition of that that caused the problem. I've tried to narrow it down into a test case in Scalaz, but been unable to. I've reproduced this on Windows and Linux.

Could someone explain what that assertion means (ideally by adding it in the assertion's message)?

`Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$$.assert(Predef.scala:92)
at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:766)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3760)
at scala.tools.nsc.typechecker.Typers$$Typer.typedHigherKindedType(Typers
.scala:3839)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$61.apply(Typers.sca
la:3630)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$61.apply(Typers.sca
la:3630)
at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4106)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)

    at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3628)
    at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
    at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedApply$$1$$1.appl

y(Typers.scala:3046)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedApply$$1$$1.appl
y(Typers.scala:3046)
at scala.tools.nsc.typechecker.Typers$$Typer.silent(Typers.scala:696)
at scala.tools.nsc.typechecker.Typers$$Typer.typedApply$$1(Typers.scala:30
46)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3648)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3808)
at scala.tools.nsc.typechecker.Typers$$Typer.computeType(Typers.scala:385
9)
at scala.tools.nsc.typechecker.Namers$$Namer.methodSig(Namers.scala:1022)

    at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1119)
    at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app

ly(Namers.scala:506)
at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app
ly(Namers.scala:504)
at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1277
)
at scala.tools.nsc.typechecker.Namers$$PolyTypeCompleter.complete(Namers.
scala:1288)
at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:712)
at scala.tools.nsc.symtab.Symbols$$Symbol.tpe(Symbols.scala:692)
at scala.tools.nsc.symtab.Symbols$$Symbol.tpeHK(Symbols.scala:847)
at scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.tpe(Implicits.scal
a:100)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.tryImplicit$$1(Im
plicits.scala:418)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfo
s$$1$$1.apply(Implicits.scala:428)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfo
s$$1$$1.apply(Implicits.scala:425)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.appInfos$$1(Impli
cits.scala:425)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applica
bleInfos$$1.apply(Implicits.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applica
bleInfos$$1.apply(Implicits.scala:436)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.collection.generic.TraversableTemplate$$class.map(TraversableTem
plate.scala:178)
at scala.collection.immutable.List.map(List.scala:26)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.applicableInfos(
Implicits.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.searchImplicit(I
mplicits.scala:457)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.bestImplicit(Imp
licits.scala:681)
at scala.tools.nsc.typechecker.Implicits$$class.inferImplicit(Implicits.s
cala:59)
at scala.tools.nsc.Global$$analyzer$$.inferImplicit(Global.scala:330)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$2.apply(Typers.scal
a:183)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$2.apply(Typers.scal
a:183)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.collection.generic.TraversableTemplate$$class.map(TraversableTem
plate.scala:178)
at scala.collection.immutable.List.map(List.scala:26)
at scala.tools.nsc.typechecker.Typers$$Typer.applyImplicitArgs(Typers.sca
la:183)
at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:783)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3760)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3808)
at scala.tools.nsc.typechecker.Typers$$Typer.computeType(Typers.scala:385
9)
at scala.tools.nsc.typechecker.Namers$$Namer.methodSig(Namers.scala:1022)

    at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1119)
    at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app

ly(Namers.scala:506)
at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app
ly(Namers.scala:504)
at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1277
)
at scala.tools.nsc.typechecker.Namers$$PolyTypeCompleter.complete(Namers.
scala:1288)
at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:712)
at scala.tools.nsc.symtab.Symbols$$Symbol.initialize(Symbols.scala:821)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3469)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3797)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:177
1)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.collection.immutable.List$$.loop$$4(List.scala:712)
at scala.collection.immutable.List$$.mapConserve(List.scala:729)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1828
)
at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1
347)
at scala.tools.nsc.typechecker.Typers$$Typer.typedClassDef(Typers.scala:1
200)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3480)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3797)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:177
1)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.collection.immutable.List$$.loop$$4(List.scala:712)
at scala.collection.immutable.List$$.mapConserve(List.scala:729)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1828
)
at scala.tools.nsc.typechecker.Typers$$Typer.typedBlock(Typers.scala:1598
)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3507)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3808)
at scala.tools.nsc.typechecker.Typers$$Typer.computeType(Typers.scala:385
9)
at scala.tools.nsc.typechecker.Namers$$Namer.methodSig(Namers.scala:1022)

    at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1119)
    at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app

ly(Namers.scala:506)
at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app
ly(Namers.scala:504)
at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1277
)
at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:712)
at scala.tools.nsc.symtab.Symbols$$Symbol.tpe(Symbols.scala:692)
at scala.tools.nsc.symtab.Symbols$$Symbol.tpeHK(Symbols.scala:847)
at scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.tpe(Implicits.scal
a:100)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.tryImplicit$$1(Im
plicits.scala:418)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfo
s$$1$$1.apply(Implicits.scala:428)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfo
s$$1$$1.apply(Implicits.scala:425)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.appInfos$$1(Impli
cits.scala:425)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applica
bleInfos$$1.apply(Implicits.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applica
bleInfos$$1.apply(Implicits.scala:436)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.collection.generic.TraversableTemplate$$class.map(TraversableTem
plate.scala:178)
at scala.collection.immutable.List.map(List.scala:26)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.applicableInfos(
Implicits.scala:436)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.searchImplicit(I
mplicits.scala:457)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.cacheResult(Impl
icits.scala:665)
at scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.bestImplicit(Imp
licits.scala:686)
at scala.tools.nsc.typechecker.Implicits$$class.inferImplicit(Implicits.s
cala:59)
at scala.tools.nsc.Global$$analyzer$$.inferImplicit(Global.scala:330)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$2.apply(Typers.scal
a:183)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$2.apply(Typers.scal
a:183)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$map$$1.apply(Tra
versableTemplate.scala:178)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.collection.generic.TraversableTemplate$$class.map(TraversableTem
plate.scala:178)
at scala.collection.immutable.List.map(List.scala:26)
at scala.tools.nsc.typechecker.Typers$$Typer.applyImplicitArgs(Typers.sca
la:183)
at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:783)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3760)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3808)
at scala.tools.nsc.typechecker.Typers$$Typer.computeType(Typers.scala:385
9)
at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1130)
at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app
ly(Namers.scala:506)
at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.app
ly(Namers.scala:504)
at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1277
)
at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:712)
at scala.tools.nsc.symtab.Symbols$$Symbol.initialize(Symbols.scala:821)
at scala.tools.nsc.symtab.Symbols$$Symbol.annotations(Symbols.scala:111)
at scala.tools.nsc.typechecker.Typers$$Typer.addGetterSetter(Typers.scala
:1250)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$11.apply(Typers.sca
la:1345)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$11.apply(Typers.sca
la:1345)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$flatMap$$1.apply
(TraversableTemplate.scala:189)
at scala.collection.generic.TraversableTemplate$$$$anonfun$$flatMap$$1.apply
(TraversableTemplate.scala:189)
at scala.collection.generic.LinearSequenceTemplate$$class.foreach(LinearS
equenceTemplate.scala:82)
at scala.collection.immutable.List.foreach(List.scala:26)
at scala.collection.generic.TraversableTemplate$$class.flatMap(Traversabl
eTemplate.scala:189)
at scala.collection.immutable.List.flatMap(List.scala:26)
at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1
345)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:
1229)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3483)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3797)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:177
1)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$21.apply(Typers.sca
la:1828)
at scala.collection.immutable.List$$.loop$$4(List.scala:712)
at scala.collection.immutable.List$$.mapConserve(List.scala:729)
at scala.collection.immutable.List$$.loop$$4(List.scala:716)
at scala.collection.immutable.List$$.mapConserve(List.scala:729)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1828
)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3476)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3755)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3797)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analy
zer.scala:57)
at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:311)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2$$$$anonfun$$ru
n$$1.apply(Analyzer.scala:51)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2$$$$anonfun$$ru
n$$1.apply(Analyzer.scala:51)
at scala.collection.Iterator$$class.foreach(Iterator.scala:500)
at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:
280)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.run(Analyze
r.scala:51)
at scala.tools.nsc.Global$$Run.compileSources(Global.scala:787)
at scala.tools.nsc.Global$$Run.compile(Global.scala:861)
at scala.tools.nsc.Main$$.process(Main.scala:95)
at scala.tools.nsc.Main$$.main(Main.scala:109)
at scala.tools.nsc.Main.main(Main.scala)`

@scabug
Copy link
Author

scabug commented Jul 25, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2197?orig=1
Reporter: Ricky Clarkson (ricky_clarkson)

@scabug
Copy link
Author

scabug commented Jul 25, 2009

Ricky Clarkson (ricky_clarkson) said:
The compilation mechanism I use to reproduce this is none of those provided by Scalaz:

find src/main/scala/scalaz -name *.scala | xargs scalac

This avoids pulling in ScalaCheck, which apparently fails to build for a separate, known, reason.

@scabug
Copy link
Author

scabug commented Jul 28, 2009

@TiarkRompf said:
Please try to narrow this down further. The assertion failure seems to indicate that the type checker is in higher-kinded-type mode in a place where it shouldn't be. According to the comments, it's trying to apply a polymorphic type to fresh instances of its type parameters.

@scabug
Copy link
Author

scabug commented Jul 29, 2009

Ricky Clarkson (ricky_clarkson) said:
It has been pointed out to me that I didn't make it clear enough that this is a REGRESSION. The same code builds with no exception on Scala 2.7.5.

I've given up trying to narrow it down by commenting out parts of Scalaz, I spent 4 days of spare time doing that before raising the ticket.

@scabug
Copy link
Author

scabug commented Aug 4, 2009

@TiarkRompf said:
Adriaan, since the assertion has to do with HK mode, can you have a look? Otherwise, without further narrowing, I'm afraid we can't do much.

@scabug
Copy link
Author

scabug commented Aug 6, 2009

@adriaanm said:
Narrowed it down to:

trait PartialType[T[_, _], A] {
  type Apply[B] = T[A, B]
}

sealed trait State[S, +A] 
trait Pure[P[_]]
trait StatePure[X] extends Pure[PartialType[State, X]#Apply]

While type checking the type application Pure[PartialType[State, X]#Apply], the type PartialType[State, X]#Apply gets normalised to [B] State[X,B], which is a PolyType that represents an anonymous type function when typing in HKmode. I think this has started happening because types are normalised more aggressively now (thus, this ticket seems related to #2208). The assert can safely be turned into a guard (which is what I'll check in asap).

NOTE: it would be interesting to know why types are getting normalised more aggressively all of a sudden -- that change might impact a lot of stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants