diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-03 17:50:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-03-03 17:50:26 +0100 |
commit | f3dacf968bc28f5f47612f75562a1a600e511815 (patch) | |
tree | 59f93971f168360b5bbc53a1934535620b6847db /src/dotty/tools/dotc/core/Definitions.scala | |
parent | f0d5662e3f8668ed33bc7442951558d861e56073 (diff) | |
download | dotty-f3dacf968bc28f5f47612f75562a1a600e511815.tar.gz dotty-f3dacf968bc28f5f47612f75562a1a600e511815.tar.bz2 dotty-f3dacf968bc28f5f47612f75562a1a600e511815.zip |
Fix of #34
The root cause of #34 was that we took a type argument which was an existential type. These are returned as type bounds, which make no sense in the calling context. To avoid that problem in the future, `typeArgs`
got renamed to `argInfos`, so it is clear we get an info, not necessarily a value type. There are
also added method `argTypes`, `argTypesLo`, `argTypesHi`, which return a type, but either throw an exception or return a lower/upper approximation of the argument is an existential type.
There's another issue that the existential type only arose when compiling the same couple fo files the seciond time. We need to chase that one down separately.
Diffstat (limited to 'src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 0ee0ea1e2..ef16a970d 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -286,7 +286,7 @@ class Definitions { def unapply(ft: Type): Option[(List[Type], Type)] = { // Dotty deviation: Type annotation needed because inferred type // is Some[(List[Type], Type)] | None, which is not a legal unapply type. val tsym = ft.typeSymbol - lazy val targs = ft.typeArgs + lazy val targs = ft.argInfos if ((FunctionClasses contains tsym) && (targs.length - 1 <= MaxFunctionArity) && (FunctionClass(targs.length - 1) == tsym)) Some((targs.init, targs.last)) // Dotty deviation: no auto-tupling @@ -317,7 +317,7 @@ class Definitions { lazy val RootImports = List[Symbol](JavaLangPackageVal, ScalaPackageVal, ScalaPredefModule, DottyPredefModule) def isTupleType(tp: Type) = { - val arity = tp.dealias.typeArgs.length + val arity = tp.dealias.argInfos.length arity <= MaxTupleArity && (tp isRef TupleClass(arity)) } @@ -329,7 +329,7 @@ class Definitions { 0 <= arity && arity <= MaxFunctionArity && (tp isRef FunctionClass(arity)) } - def functionArity(tp: Type) = tp.dealias.typeArgs.length - 1 + def functionArity(tp: Type) = tp.dealias.argInfos.length - 1 // ----- Higher kinds machinery ------------------------------------------ |