Closed
Description
Trying to access viewl in the attached FingerTree class crashes the compiler:
$$ sbt update console
...
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import de.sciss.fingertree._
import de.sciss.fingertree._
scala> def nearest[ A ]( ft: FingerTree.Ordered[ A ], v: A ) = { val (left, right) = ft.splitAt( v ); right.value.viewl }
java.lang.Error: B in class FingerTree cannot be instantiated from right.FT
at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:33)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.throwError$$1(Types.scala:3281)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.instParam$$1(Types.scala:3284)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.toInstance$$1(Types.scala:3295)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3311)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3189)
at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:3023)
at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:3019)
at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4723)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4724)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:3019)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2929)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3313)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3189)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2953)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3313)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3189)
at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:3023)
at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:3019)
at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4723)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:3019)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2929)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3313)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3189)
at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2953)
at scala.tools.nsc.symtab.Types$$AsSeenFromMap.apply(Types.scala:3313)
at scala.tools.nsc.symtab.Types$$Type.asSeenFrom(Types.scala:516)
at scala.tools.nsc.symtab.Types$$Type.computeMemberType(Types.scala:540)
at scala.tools.nsc.symtab.Symbols$$MethodSymbol.typeAsMemberOf(Symbols.scala:1780)
at scala.tools.nsc.symtab.Types$$Type.memberType(Types.scala:531)
at scala.tools.nsc.typechecker.Infer$$Inferencer.checkAccessible(Infer.scala:273)
at scala.tools.nsc.typechecker.Typers$$Typer.makeAccessible(Typers.scala:610)
at scala.tools.nsc.typechecker.Typers$$Typer.typedSelect$$1(Typers.scala:3607)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:4110)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$$Typer.typedBlock(Typers.scala:1949)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3894)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4203)
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.methodSig(Namers.scala:901)
at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1134)
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.typechecker.Namers$$PolyTypeCompleter.complete(Namers.scala:1320)
at scala.tools.nsc.typechecker.Namers$$PolyTypeCompleter.complete(Namers.scala:1314)
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.typechecker.Typers$$Typer.typed1(Typers.scala:3840)
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.typedTemplate(Typers.scala:1549)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3856)
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.typedTemplate(Typers.scala:1549)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3856)
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.typedTemplate(Typers.scala:1549)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3856)
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.typedTemplate(Typers.scala:1549)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3856)
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.typedTemplate(Typers.scala:1549)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3856)
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(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.Interpreter.compileAndSaveRun(Interpreter.scala:518)
at scala.tools.nsc.Interpreter$$Request.objRun(Interpreter.scala:892)
at scala.tools.nsc.Interpreter$$Request.compile(Interpreter.scala:915)
at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:598)
at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:577)
at scala.tools.nsc.InterpreterLoop.reallyInterpret$$1(InterpreterLoop.scala:472)
at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:515)
at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:362)
at scala.tools.nsc.InterpreterLoop.processLine$$1(InterpreterLoop.scala:243)
at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:249)
at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:559)
at xsbt.ConsoleInterface.run(ConsoleInterface.scala:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at xsbt.AnalyzingCompiler.call(AnalyzingCompiler.scala:40)
at xsbt.AnalyzingCompiler.console(AnalyzingCompiler.scala:32)
at sbt.Console.console0$$1(Compile.scala:141)
at sbt.Console$$$$anonfun$$apply$$4$$$$anonfun$$apply$$5.apply(Compile.scala:142)
at sbt.Console$$$$anonfun$$apply$$4$$$$anonfun$$apply$$5.apply(Compile.scala:142)
at sbt.TrapExit$$.executeMain$$1(TrapExit.scala:33)
at sbt.TrapExit$$$$anon$$1.run(TrapExit.scala:42)
What versions of the following are you using?
Scala: 2.8.0 final and 2.8.1 final
Java: Java HotSpot(TM) Client VM, Java 1.6.0_22
Operating system: OS X 10.6.4
sorry, this code comes from Scalaz, and to be honest, I have not a big clue about the implication of type
viewl: ViewL[PartialApply1Of2[FingerTree, V]#Apply, A]
The classes themselves compile fine...