-
Notifications
You must be signed in to change notification settings - Fork 21
"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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-2741?orig=1
|
@retronym said: |
@retronym said: |
@retronym said: |
@retronym said: 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) |
Runar (runar) said: Check out from here: 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] |
@pchiusano said: |
@pchiusano said: 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
} |
@pchiusano said: |
@adriaanm said: motivation:
uncurry has been relying on an ugly hack to distinguish these cases based on ad-hoc kind inference 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) 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) NullaryMethodType is eliminated during uncurry pickling: the rewrite probably isn't complete, but was validated by compiling against the old scalacheck jar (which has plenty of polymorphic nullary methods) summary of the refactoring:
TODO: scalap and eclipse review by odersky, rytz |
@adriaanm said: this inappropriate owner caused asSeenFrom to turn to an unrelated class for information about the actual type of a type parameter |
@adriaanm said: 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 |
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:
The text was updated successfully, but these errors were encountered: