diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-08 11:05:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-11 10:07:32 +0200 |
commit | c9679f6c0f3c8200e1b1f537e89488094cfc2576 (patch) | |
tree | 59f142f2b241049737bfb71838235a4451d40cc1 /src/dotty/tools/dotc/core/Definitions.scala | |
parent | 0af96c0f5179104fca02cf1aa144c6176bdb71eb (diff) | |
download | dotty-c9679f6c0f3c8200e1b1f537e89488094cfc2576.tar.gz dotty-c9679f6c0f3c8200e1b1f537e89488094cfc2576.tar.bz2 dotty-c9679f6c0f3c8200e1b1f537e89488094cfc2576.zip |
Added functionality to deal with function applications.
- Added Applications class to represent applications
- Added Constraint class to represent type constraints
- Added TyperState class to represent typer state
- Added Diagnostic class to buffer errors and warnings
- Added Inferencing class that contains some common functionality for type inferencing (this one's still rudimentary).
- Added extractor for FunctionType in Definitions
- Added desugaring of default parameters to default getters in Desugar
- Added flags to deal with default parameters
- Added substitutions that replace bound parameters
Diffstat (limited to 'src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 9d7f84449..66ed61a7f 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -263,8 +263,18 @@ class Definitions(implicit ctx: Context) { // - .linkedClass: the ClassSymbol of the enumeration (class E) sym.owner.linkedClass.typeConstructor - def FunctionType(args: List[Type], resultType: Type) = - FunctionClass(args.length).typeConstructor.appliedTo(args :+ resultType) + object FunctionType { + def apply(args: List[Type], resultType: Type) = + FunctionClass(args.length).typeConstructor.appliedTo(args :+ resultType) + def unapply(ft: Type) = { + val tsym = ft.typeSymbol + lazy val targs = ft.typeArgs + if ((FunctionClasses contains tsym) && + (targs.length - 1 <= MaxFunctionArity) && + (FunctionClass(targs.length - 1) == tsym)) Some(targs.init, targs.last) + else None + } + } // ----- Symbol sets --------------------------------------------------- |