Skip to content

"B in trait MAs cannot be instantiated from object ..." #2741

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

Closed
scabug opened this issue Dec 1, 2009 · 13 comments
Closed

"B in trait MAs cannot be instantiated from object ..." #2741

scabug opened this issue Dec 1, 2009 · 13 comments
Assignees

Comments

@scabug
Copy link

scabug commented Dec 1, 2009

To reproduce, svn checkout:

https://scalaz.googlecode.com/svn/branches/type-B-cannot-be-instantiated-bug

and compile sources under src/main.

Tested against Scala Beta RC2.

We're using higher kinded inference.

Full compiler error:

Information:Compilation completed with 73 errors and 0 warnings
Information:73 errors
Information:0 warnings
Error:Scalac internal error: class java.lang.reflect.InvocationTargetException [sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25), java.lang.reflect.Method.invoke(Method.java:597), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)][scala.tools.nsc.symtab.Types$$AsSeenFromMap.throwError$$1(Types.scala:3104), scala.tools.nsc.symtab.Types$$AsSeenFromMap.instParam$$1(Types.scala:3109), scala.tools.nsc.symtab.Types$$AsSeenFromMap.toInstance$$1(Types.scala:3120), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3136), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009), scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2843), scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2839), scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4282), scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13), scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2839), scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2763), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009), scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009), scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2843), scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2839), scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4282), scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13), scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2839), scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2763), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009), scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2795), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009), scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803), scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138), scala.tools.nsc.symtab.Types$$Type.asSeenFrom(Types.scala:498), scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:528), scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.tpe(Implicits.scala:99), scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.isCyclicOrErroneous(Implicits.scala:112), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.tryImplicit$$1(Implicits.scala:533), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfos$$1$$1.apply(Implicits.scala:546), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfos$$1$$1.apply(Implicits.scala:543), scala.collection.LinearSeqLike$$class.foreach(LinearSeqLike.scala:88), scala.collection.immutable.List.foreach(List.scala:29), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.appInfos$$1(Implicits.scala:543), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applicableInfos$$1.apply(Implicits.scala:554), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applicableInfos$$1.apply(Implicits.scala:554), scala.collection.TraversableLike$$$$anonfun$$map$$1.apply(TraversableLike.scala:159), scala.collection.TraversableLike$$$$anonfun$$map$$1.apply(TraversableLike.scala:159), scala.collection.LinearSeqLike$$class.foreach(LinearSeqLike.scala:88), scala.collection.immutable.List.foreach(List.scala:29), scala.collection.TraversableLike$$class.map(TraversableLike.scala:159), scala.collection.immutable.List.map(List.scala:29), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.applicableInfos(Implicits.scala:554), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.searchImplicit(Implicits.scala:575), scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.bestImplicit(Implicits.scala:801), scala.tools.nsc.typechecker.Implicits$$class.inferImplicit(Implicits.scala:57), scala.tools.nsc.Global$$analyzer$$.inferImplicit(Global.scala:325), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:184), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:179), scala.collection.LinearSeqLike$$class.foreach(LinearSeqLike.scala:88), scala.collection.immutable.List.foreach(List.scala:29), scala.tools.nsc.typechecker.Typers$$Typer.applyImplicitArgs(Typers.scala:179), scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:822), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3996), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4036), scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2025), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.collection.immutable.List.loop$$1(List.scala:109), scala.collection.immutable.List.mapConserve(List.scala:126), scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer.typedBlock(Typers.scala:1850), scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3693), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3991), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4049), scala.tools.nsc.typechecker.Typers$$Typer.transformedOrTyped(Typers.scala:4136), scala.tools.nsc.typechecker.Typers$$Typer.typedDefDef(Typers.scala:1752), scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3672), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3991), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4036), scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2025), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.collection.immutable.List.loop$$1(List.scala:109), scala.collection.immutable.List.mapConserve(List.scala:126), scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1492), scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1305), scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3666), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3991), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4036), scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2025), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084), scala.collection.immutable.List.loop$$1(List.scala:109), scala.collection.immutable.List.mapConserve(List.scala:126), scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2084), scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3659), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3991), scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4036), scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analyzer.scala:57), scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:306), scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2$$$$anonfun$$run$$1.apply(Analyzer.scala:51), scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2$$$$anonfun$$run$$1.apply(Analyzer.scala:51), scala.collection.Iterator$$class.foreach(Iterator.scala:552), scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:285), scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.run(Analyzer.scala:51), scala.tools.nsc.Global$$Run.compileSources(Global.scala:773), scala.tools.nsc.Global$$Run.compile(Global.scala:863), scala.tools.nsc.Main$$.process(Main.scala:109), scala.tools.nsc.Main$$.main(Main.scala:123), scala.tools.nsc.Main.main(Main.scala), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25), java.lang.reflect.Method.invoke(Method.java:597), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)]
Error:sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Error:sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Error:java.lang.reflect.Method.invoke(Method.java:597)
Error:org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)
Error:Caused by java.lang.Error: B in trait MAs cannot be instantiated from object scalaz.Scalaz
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.throwError$$1(Types.scala:3104)
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.instParam$$1(Types.scala:3109)
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.toInstance$$1(Types.scala:3120)
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3136)
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3009)
Error:scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2843)
Error:scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2839)
Error:scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4282)
Error:scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
Error:scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2839)
Error:scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2763)
Error:scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3138)
Error:scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803)
Error:scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2795)
Error:scala.tools.nsc.symtab.Types$$Type.asSeenFrom(Types.scala:498)
Error:scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:528)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.tpe(Implicits.scala:99)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitInfo.isCyclicOrErroneous(Implicits.scala:112)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.tryImplicit$$1(Implicits.scala:533)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfos$$1$$1.apply(Implicits.scala:546)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$appInfos$$1$$1.apply(Implicits.scala:543)
Error:scala.collection.LinearSeqLike$$class.foreach(LinearSeqLike.scala:88)
Error:scala.collection.immutable.List.foreach(List.scala:29)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.appInfos$$1(Implicits.scala:543)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch$$$$anonfun$$applicableInfos$$1.apply(Implicits.scala:554)
Error:scala.collection.TraversableLike$$$$anonfun$$map$$1.apply(TraversableLike.scala:159)
Error:scala.collection.TraversableLike$$class.map(TraversableLike.scala:159)
Error:scala.collection.immutable.List.map(List.scala:29)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.applicableInfos(Implicits.scala:554)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.searchImplicit(Implicits.scala:575)
Error:scala.tools.nsc.typechecker.Implicits$$ImplicitSearch.bestImplicit(Implicits.scala:801)
Error:scala.tools.nsc.typechecker.Implicits$$class.inferImplicit(Implicits.scala:57)
Error:scala.tools.nsc.Global$$analyzer$$.inferImplicit(Global.scala:325)
Error:scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:184)
Error:scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:179)
Error:scala.tools.nsc.typechecker.Typers$$Typer.applyImplicitArgs(Typers.scala:179)
Error:scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:822)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3996)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4036)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2025)
Error:scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:2084)
Error:scala.collection.immutable.List.loop$$1(List.scala:109)
Error:scala.collection.immutable.List.mapConserve(List.scala:126)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2084)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedBlock(Typers.scala:1850)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3693)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3991)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4049)
Error:scala.tools.nsc.typechecker.Typers$$Typer.transformedOrTyped(Typers.scala:4136)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedDefDef(Typers.scala:1752)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3672)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1492)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1305)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3666)
Error:scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3659)
Error:scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analyzer.scala:57)
Error:scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:306)
Error:scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2$$$$anonfun$$run$$1.apply(Analyzer.scala:51)
Error:scala.collection.Iterator$$class.foreach(Iterator.scala:552)
Error:scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:285)
Error:scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.run(Analyzer.scala:51)
Error:scala.tools.nsc.Global$$Run.compileSources(Global.scala:773)
Error:scala.tools.nsc.Global$$Run.compile(Global.scala:863)
Error:scala.tools.nsc.Main$$.process(Main.scala:109)
Error:scala.tools.nsc.Main$$.main(Main.scala:123)
Error:scala.tools.nsc.Main.main(Main.scala)
@scabug
Copy link
Author

scabug commented Dec 1, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2741?orig=1
Reporter: @retronym
Attachments:

  • 2741.zip (created on Jan 7, 2010 9:02:23 AM UTC, 5366 bytes)

@scabug
Copy link
Author

scabug commented Dec 1, 2009

@retronym said:
Note that cut-paste of the Function1FlipMA and SeqMA from MAs to Scalaz works around the problem.

@scabug
Copy link
Author

scabug commented Jan 7, 2010

@retronym said:
This is unrelated to higher-kinded inference.

@scabug
Copy link
Author

scabug commented Jan 7, 2010

@retronym said:
The attachment contains a minimised test case, please ignore the steps to reproduce above and instead look at 2741.zip.

@scabug
Copy link
Author

scabug commented Feb 26, 2010

@adriaanm said:
(In r21000) closes #2741 closes #3079 no review
worksforme

@scabug
Copy link
Author

scabug commented Feb 27, 2010

@retronym said:
This is still broken for me. I tested with the r21004 (build on Hudson).

In order to get partest to compile the files separately, I think you need to rename them as: 2741_1.scala 2741_2.scala

-jason

+ export SCALAC=/Users/jason/usr/scala-hudson/bin/scalac
+ SCALAC=/Users/jason/usr/scala-hudson/bin/scalac
+ java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226)
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-92, mixed mode)
+ /Users/jason/usr/scala-hudson/bin/scalac -version
Scala compiler version 2.8.0.r21004-b20100226193211 -- Copyright 2002-2010, LAMP/EPFL
+ mkdir -p out
+ rm 'out/*'
rm: out/*: No such file or directory
+ /Users/jason/usr/scala-hudson/bin/scalac -d out -classpath out 2741-1.scala 2741-2.scala
+ rm out/Kleisli.class out/MA.class 'out/MAs$$class.class' out/MAs.class out/PartialApplyKA.class 'out/Scalaz$$.class' out/Scalaz.class 'out/Test$$.class' out/Test.class
+ /Users/jason/usr/scala-hudson/bin/scalac -d out -classpath out 2741-1.scala
+ /Users/jason/usr/scala-hudson/bin/scalac -d out -classpath out 2741-2.scala
Exception in thread "main" java.lang.Error: A in trait MAs cannot be instantiated from object Scalaz
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.throwError$$1(Types.scala:3131)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.instParam$$1(Types.scala:3136)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.toInstance$$1(Types.scala:3147)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3163)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2873)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4550)
	at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:14)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2779)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2873)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4550)
	at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:14)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2779)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2873)
	at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4550)
	at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:14)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2869)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2779)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3039)
	at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2803)
	at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3165)
	at scala.tools.nsc.symtab.Types$$Type.asSeenFrom(Types.scala:502)
	at scala.tools.nsc.symtab.Types$$Type.computeMemberType(Types.scala:526)
	at scala.tools.nsc.symtab.Symbols$$MethodSymbol.typeAsMemberOf(Symbols.scala:1728)
	at scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:517)
	at scala.tools.nsc.typechecker.Infer$$Inferencer.checkAccessible(Infer.scala:380)
	at scala.tools.nsc.typechecker.Typers$$Typer.makeAccessible(Typers.scala:617)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedSelect$$1(Typers.scala:3550)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:4024)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4117)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2126)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2194)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2194)
	at scala.collection.immutable.List.loop$$1(List.scala:116)
	at scala.collection.immutable.List.mapConserve(List.scala:133)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2194)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1526)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1338)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3775)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4117)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2126)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2194)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2194)
	at scala.collection.immutable.List.loop$$1(List.scala:116)
	at scala.collection.immutable.List.mapConserve(List.scala:133)
	at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2194)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3768)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4117)
	at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4170)
	at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.apply(Analyzer.scala:82)
	at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:273)
	at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:273)
	at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
	at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:273)
	at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:77)
	at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:77)
	at scala.collection.Iterator$$class.foreach(Iterator.scala:582)
	at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:287)
	at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.run(Analyzer.scala:77)
	at scala.tools.nsc.Global$$Run.compileSources(Global.scala:730)
	at scala.tools.nsc.Global$$Run.compile(Global.scala:816)
	at scala.tools.nsc.Main$$.process(Main.scala:109)
	at scala.tools.nsc.Main$$.main(Main.scala:123)
	at scala.tools.nsc.Main.main(Main.scala)

@scabug
Copy link
Author

scabug commented Jun 22, 2010

Runar (runar) said:
Encountering this bug in scalaz.FingerTree. Haven't found a workaround.

Check out from here:
git://github.com/runarorama/scalaz.git

And compile the following:

object Bug {
  import scalaz._
  import Scalaz._
  val f = (a: FingerTree[Int, String] => a.viewr)
}
scala> import scalaz._
import scalaz._

scala> import Scalaz._
import Scalaz._

scala> import FingerTree._
import FingerTree._

scala> implicit def sizeReducer[A] = Reducer((a: A) => 1)
sizeReducer: [A]scalaz.Reducer[A,Int]

scala> empty[Int, String]
res0: scalaz.FingerTree[Int,String] = 0 []

scala> res0.viewr
java.lang.Error: B in class FingerTree cannot be instantiated from scalaz.FingerTree[Int,String]
        at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:33)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.throwError$$1(Types.scala:3177)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.instParam$$1(Types.scala:3180)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.toInstance$$1(Types.scala:3191)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3207)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3085)
        at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2919)
        at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2915)
        at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4607)
        at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
        at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4608)
        at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2915)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2825)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3209)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3085)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2849)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3209)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3085)
        at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2919)
        at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2915)
        at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4607)
        at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2915)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2825)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3209)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3085)
        at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2849)
        at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3209)
        at scala.tools.nsc.symtab.Types$$Type.asSeenFrom(Types.scala:507)
        at scala.tools.nsc.symtab.Types$$Type.computeMemberType(Types.scala:531)
        at scala.tools.nsc.symtab.Symbols$$MethodSymbol.typeAsMemberOf(Symbols.scala:1774)
        at scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:522)
        at scala.tools.nsc.typechecker.Infer$$Inferencer.checkAccessible(Infer.scala:278)
        at scala.tools.nsc.typechecker.Typers$$Typer.makeAccessible(Typers.scala:591)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedSelect$$1(Typers.scala:3509)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3985)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4139)
        at scala.tools.nsc.typechecker.Typers$$Typer.computeType(Typers.scala:4215)
        at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1174)
        at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:517)
        at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:515)
        at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1338)
        at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1336)
        at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:743)
        at scala.tools.nsc.symtab.Symbols$$Symbol.initialize(Symbols.scala:855)
        at scala.tools.nsc.symtab.Symbols$$Symbol.annotations(Symbols.scala:111)
        at scala.tools.nsc.typechecker.Typers$$Typer.addGetterSetter(Typers.scala:1334)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$10.apply(Typers.scala:1505)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$10.apply(Typers.scala:1505)
        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:1505)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1507)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1312)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3736)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2067)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        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:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3729)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4078)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4126)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.apply(Analyzer.scala:85)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:276)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:276)
        at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
        at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:276)
        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:733)
        at scala.tools.nsc.Interpreter.compileAndSaveRun(Interpreter.scala:516)
        at scala.tools.nsc.Interpreter$$Request.objRun(Interpreter.scala:890)
        at scala.tools.nsc.Interpreter$$Request.compile(Interpreter.scala:913)
        at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:596)
        at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:575)
        at scala.tools.nsc.InterpreterLoop.reallyInterpret$$1(InterpreterLoop.scala:471)
        at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:514)
        at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:361)
        at scala.tools.nsc.InterpreterLoop.processLine$$1(InterpreterLoop.scala:242)
        at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:248)
        at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:558)
        at xsbt.ConsoleInterface.run(ConsoleInterface.scala:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at xsbt.AnalyzingCompiler.call(AnalyzingCompiler.scala:40)
        at xsbt.AnalyzingCompiler.console(AnalyzingCompiler.scala:32)
        at sbt.Console.console0$$1(Compile.scala:140)
        at sbt.Console$$$$anonfun$$apply$$4$$$$anonfun$$apply$$5.apply(Compile.scala:141)
        at sbt.Console$$$$anonfun$$apply$$4$$$$anonfun$$apply$$5.apply(Compile.scala:141)
        at sbt.TrapExit$$.executeMain$$1(TrapExit.scala:33)
        at sbt.TrapExit$$$$anon$$1.run(TrapExit.scala:42)
[info] == console ==
[error] Error running console: Nonzero exit code: 1
[info]

@scabug
Copy link
Author

scabug commented Dec 13, 2010

@pchiusano said:
I just posted another ticket - it may in fact be the same bug - with a smaller test case: #4079

@scabug
Copy link
Author

scabug commented Dec 13, 2010

@pchiusano said:
I found what looks to be a workaround, using [http://groups.google.com/group/scalaz/browse_thread/thread/862543e872b09f3c type lambdas] instead of the ComposeT trait. The working file looks like:

trait Functor[F[_]] {
  def map[A,B](fa: F[A], f: A => B): F[B]
}

case class Compose[F[_],G[_]]() {
  def Functor(implicit f: Functor[F], g: Functor[G]): Functor[({type f[x] = F[G[x]]})#f] =
    new Functor[({type f[x] = F[G[x]]})#f] {
      def map[A,B](c: F[G[A]], h: A => B): F[G[B]] = 
        f.map(c, (x:G[A]) => g.map(x,h))
    }
}

object Cat {
  def compose[F[_],G[_]] = Compose[F,G]()
}

object Functors {
  implicit val List = new Functor[List] { 
    def map[A,B](fa: List[A], f: A => B): List[B] = fa map f
  }
  implicit val Option = new Functor[Option] { 
    def map[A,B](fa: Option[A], f: A => B): Option[B] = fa map f
  }
}

object Main {
  import Functors._
  val cf = Cat.compose[List,Option].Functor
}

@scabug
Copy link
Author

scabug commented Dec 13, 2010

@pchiusano said:
I'm sorry, I meant to post that last comment to #4709.

@scabug
Copy link
Author

scabug commented Jan 20, 2011

@adriaanm said:
(In r24029) introduce NullaryMethodType to disambiguate PolyType

motivation:
given def foo[T]: (T, T) and type Foo[T] = (T, T),

foo.info and TypeRef(_, Foo, Nil).normalize are both PolyType(List(T), Pair[T, T])

uncurry has been relying on an ugly hack to distinguish these cases based on ad-hoc kind inference
without this distinction, the type alias's info (a type function) would be transformed to PolyType(List(T), MethodType(Nil, Pair[T, T]))

anonymous type functions are being used more often (see #2741, #4017, #4079, #3443, #3106), which makes a proper treatment of PolyTypes more pressing

change to type representation:
PolyType(Nil, tp) -> NullaryMethodType(tp)
PolyType(tps, tp) -> PolyType(tps, NullaryMethodType(tp)) (if the polytype denoted a polymorphic nullary method)

PolyType(Nil, tp) is now invalid

the kind of a PolyType is * iff its resulttype is a NullaryMethodType or a MethodType (i.e., it's a polymorphic value)
in all other cases a PolyType now denotes a type constructor

NullaryMethodType is eliminated during uncurry

pickling:
for backwards compatibility, a NullaryMethodType(tp) is still pickled as a PolyType(Nil, tp),
unpickling rewrites pre-2.9-pickled PolyTypes according to the expected kind of the unpickled type (similar to what we used to do in uncurry)
a pickled PolyType(Nil, restpe) is unpickled to NullaryMethodType(restpe)
a pickled PolyType(tps, restpe) is unpickled to PolyType(tps, NullaryMethodType(restpe)) when the type is expected to have kind *

the rewrite probably isn't complete, but was validated by compiling against the old scalacheck jar (which has plenty of polymorphic nullary methods)
nevertheless, this commit includes a new scalacheck jar

summary of the refactoring:

  • PolyType(List(), tp) or PolyType(Nil, tp) or PolyType(parms, tp) if params.isEmpty ==> NullaryMethodType(tp)

  • whenever there was a case PolyType(tps, tp) (irrespective of tps isEmpty), now need to consider the
    case PolyType(tps, NullaryMethodType(tp)); just add a case NullaryMethodType(tp), since usually:

    • there already is a PolyType case that recurses on the result type,
    • the polytype case applied to empty and non-empty type parameter lists alike
  • tp.resultType, where tp was assumed to be a PolyType that represents a polymorphic nullary method type
    before, tp == PolyType(tps, res), now tp == PolyType(tps, NullaryMethodType(res))

  • got bitten again (last time was dependent-method types refactoring) by a TypeMap not being the identity when dropNonConstraintAnnotations is true (despite having an identity apply method). Since asSeenFrom is skipped when isTrivial, the annotations aren't dropped. The cps plugin relies on asSeenFrom dropping these annotations for trivial types though. Therefore, NullaryMethodType pretends to never be trivial. Better fix(?) in AsSeenFromMap: if(tp.isTrivial) dropNonContraintAnnotations(tp) else ...

TODO: scalap and eclipse

review by odersky, rytz

@scabug
Copy link
Author

scabug commented Jan 25, 2011

@adriaanm said:
the main problem was that the pickler changed the owner of a type param from the type alias that defines it to the top-level class of the compilation unit in which its eta-expansion (a polytype) occurs (when the owning type alias is not local to the compilation unit in which its eta-expansion occurs)

this inappropriate owner caused asSeenFrom to turn to an unrelated class for information about the actual type of a type parameter

@scabug
Copy link
Author

scabug commented Jan 26, 2011

@adriaanm said:
(In r24091) closes #2741, #4079: pickling now ensures that a local type param with a non-local owner, which will thus get a localized owner, will only get a class as its localized owner if its old owner was a class (otherwise, NoSymbol)
this ensures that asSeenFrom does not treat typerefs to this symbol differently after pickling.

todo: should we pro-actively set the owner of these type params to something else than the type alias that they originate from? see notes in typeFunAnon

review by odersky

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