Aladdin - Scala Bugtracking
[#1289] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin moved to trac 2007-08-23 20:45:37.0
subject inter-package protected nested-trait poymorphic expression crash
code
// two packages
// pkg1/Presentations.scala
package pkg1
trait Presentations {
   trait ProjectImpl {
     trait FileImpl
     protected def lockTyper[T](f : => T) = {
       if (this == null) None
       else Some(f)
     }
   }
}
// pkg2/PresentationsX.scala
package pkg2
trait PresentationsX extends pkg1.Presentations {
   trait ProjectImpl extends super.ProjectImpl {
     trait FileImpl extends super.FileImpl {
       lockTyper(Console.println)
     }
   }
}
what happened
scala.tools.nsc.symtab.Types$TypeError: polymorphic expression cannot  
be instantiated to expected type;
  found   : [T(in method lockTyper)](=> T(in method lockTyper))Option 
[T(in method lockTyper)]
  required: Option[(some other)T(in method lockTyper)]
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala: 
366)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:218)
	at scala.tools.nsc.typechecker.Infer$Inferencer.substExpr 
(Infer.scala:763)
	at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance 
(Infer.scala:748)
	at scala.tools.nsc.typechecker.Typers$Typer.instantiate(Typers.scala: 
795)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:734)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:624)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2961)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3003)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped 
(Typers.scala:3052)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala: 
1262)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2700)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2959)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2992)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.makeAccessor(SuperAccessors.scala:253)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:130)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1320)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:191)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:185)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala: 
1355)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate 
(Trees.scala:1357)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1253)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:99)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala: 
1355)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate 
(Trees.scala:1357)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1253)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:99)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$27.apply 
(Trees.scala:1355)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala: 
1355)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$ 
$anonfun$8.apply(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:112)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate 
(Trees.scala:1357)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply 
(Trees.scala:1254)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1253)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:99)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply 
(Trees.scala:1373)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply 
(Trees.scala:1371)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala: 
1371)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply 
(Trees.scala:1250)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply 
(Trees.scala:1250)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1379)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.atOwner(SuperAccessors.scala:202)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1249)
	at scala.tools.nsc.transform.TypingTransformers 
$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors 
$SuperAccTransformer.transform(SuperAccessors.scala:191)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala: 
1374)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:245)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala: 
233)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala: 
233)
	at scala.Iterator$class.foreach(Iterator.scala:375)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach 
(ListBuffer.scala:255)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:233)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:540)
	at scala.tools.nsc.Global$Run.compile(Global.scala:625)
	at ch.epfl.lamp.sdt.build.ScalaCompilerManager$ScalaCompiler.compile 
(ScalaCompilerManager.java:263)
	at ch.epfl.lamp.sdt.build.ScalaProjectBuilder.build 
(ScalaProjectBuilder.java:153)
	at org.eclipse.core.internal.events.BuildManager$2.run 
(BuildManager.java:624)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild 
(BuildManager.java:166)
	at org.eclipse.core.internal.events.BuildManager.basicBuild 
(BuildManager.java:197)
	at org.eclipse.core.internal.events.BuildManager$1.run 
(BuildManager.java:246)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild 
(BuildManager.java:249)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop 
(BuildManager.java:302)
	at org.eclipse.core.internal.events.BuildManager.build 
(BuildManager.java:334)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild 
(AutoBuildJob.java:137)
	at org.eclipse.core.internal.events.AutoBuildJob.run 
(AutoBuildJob.java:235)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

what expected
[back to overview]
Changes of this bug report
Gilles  edited on  2007-08-29 09:55:36.0