diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-02-09 14:45:42 +0100 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-02-13 18:29:02 +0100 |
commit | 93a2d0653e6b74a0f88825ac8a522da87e474f2a (patch) | |
tree | 7a97d30544f09083ec0561478bf49b78fb44f2ab /compiler/src/dotty/tools/dotc/typer/Typer.scala | |
parent | b29783237c03ade1dd19cc564170c7a87d7b8b84 (diff) | |
download | dotty-93a2d0653e6b74a0f88825ac8a522da87e474f2a.tar.gz dotty-93a2d0653e6b74a0f88825ac8a522da87e474f2a.tar.bz2 dotty-93a2d0653e6b74a0f88825ac8a522da87e474f2a.zip |
Add checks for synthetic functions and erased functions.
* Add `isSyntheticFunction` checks for synthetic functions such as FuntionN
for N > 22 and ImplicitFunctionN for N >= 0.
* Add `erasedFunctionClass` to get the erased verion of synthetic functions.
* Change the semantics of `isFunctionClass` to return true if it is any kind of
FunctionN or ImplicitFunctionN.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index ded8993fb..e04667223 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -664,9 +664,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedFunction(tree: untpd.Function, pt: Type)(implicit ctx: Context) = track("typedFunction") { val untpd.Function(args, body) = tree if (ctx.mode is Mode.Type) { - val funCls = - if (tree.isInstanceOf[untpd.ImplicitFunction]) defn.ImplicitFunctionClass(args.length) - else defn.FunctionClass(args.length) + val funCls = defn.FunctionClass(args.length, tree.isInstanceOf[untpd.ImplicitFunction]) typed(cpy.AppliedTypeTree(tree)( untpd.TypeTree(funCls.typeRef), args :+ body), pt) } @@ -1937,7 +1935,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit !untpd.isImplicitClosure(tree) && !isApplyProto(pt) && !ctx.isAfterTyper) { - typr.println("insert apply on implicit $tree") + typr.println(i"insert apply on implicit $tree") typed(untpd.Select(untpd.TypedSplice(tree), nme.apply), pt) } else if (ctx.mode is Mode.Pattern) { |