diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-30 12:46:57 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-30 12:46:57 +0200 |
commit | cc687b406d1f3a6f0f6d47a9d364c3eba46792e1 (patch) | |
tree | c9e040a3de69657b37b891ea81bbd8e3c91bd322 /src/dotty/tools/dotc/core/Definitions.scala | |
parent | c8d13a88f10fa5c14f83cc0ed62c938c550d622f (diff) | |
download | dotty-cc687b406d1f3a6f0f6d47a9d364c3eba46792e1.tar.gz dotty-cc687b406d1f3a6f0f6d47a9d364c3eba46792e1.tar.bz2 dotty-cc687b406d1f3a6f0f6d47a9d364c3eba46792e1.zip |
Function and multi-array type methods get implicit contexts.
Otherwise the context captured by Definitions applies. And that one leads
to illegal types being constructed after erasure.
We should think how we can better avoid the trap of captured contexts here.
Diffstat (limited to 'src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index c53e00152..cace6df74 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -361,9 +361,9 @@ class Definitions { sym.owner.linkedClass.typeRef object FunctionType { - def apply(args: List[Type], resultType: Type) = + def apply(args: List[Type], resultType: Type)(implicit ctx: Context) = FunctionClass(args.length).typeRef.appliedTo(args ::: resultType :: Nil) - def unapply(ft: Type)/*: Option[(List[Type], Type)]*/ = { + def unapply(ft: Type)(implicit ctx: Context)/*: Option[(List[Type], Type)]*/ = { // -language:keepUnions difference: unapply needs result type because inferred type // is Some[(List[Type], Type)] | None, which is not a legal unapply type. val tsym = ft.typeSymbol @@ -385,9 +385,9 @@ class Definitions { } object MultiArrayType { - def apply(elem: Type, ndims: Int): Type = + def apply(elem: Type, ndims: Int)(implicit ctx: Context): Type = if (ndims == 0) elem else ArrayType(apply(elem, ndims - 1)) - def unapply(tp: Type): Option[(Type, Int)] = tp match { + def unapply(tp: Type)(implicit ctx: Context): Option[(Type, Int)] = tp match { case ArrayType(elemtp) => elemtp match { case MultiArrayType(finalElemTp, n) => Some(finalElemTp, n + 1) |