Created
December 18, 2009 08:32
-
-
Save retronym/259378 to your computer and use it in GitHub Desktop.
A foray into dependant types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type HasTree = { type Tree } | |
def r[HT <: HasTree](x: HT)(y: x.Tree) = null | |
//r: [HT <: HasTree](x$0:HT)(x$0:<param 1.0>#Tree)Null | |
trait T { type Tree } | |
//defined trait T | |
r(new T{ type Tree = Int})(1) | |
/*Exception in thread "main" java.lang.AssertionError: assertion failed: <param 1.0>.type Tree does no longer exist, phase = namer | |
at scala.tools.nsc.symtab.Types$adaptToNewRunMap$.adaptToNewRun(Types.scala:3529) | |
at scala.tools.nsc.symtab.Types$adaptToNewRunMap$.apply(Types.scala:3569) | |
at scala.tools.nsc.symtab.Symbols$Symbol.adaptToNewRun$1(Symbols.scala:853) | |
at scala.tools.nsc.symtab.Symbols$Symbol.adaptInfos(Symbols.scala:857) | |
at scala.tools.nsc.symtab.Symbols$Symbol.rawInfo(Symbols.scala:815) | |
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:772) | |
at scala.tools.nsc.symtab.Types$TypeMap$$anonfun$15.apply(Types.scala:28*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment