diff options
author | Martin Odersky <odersky@gmail.com> | 2016-06-29 20:00:59 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:02 +0200 |
commit | 60d81f81ddfc85719fd303e8d15d3891adbf4dfd (patch) | |
tree | 17e830e9e73157451c1a46ba2d716ca0d1037f97 /src/dotty/tools/dotc/typer/TypeAssigner.scala | |
parent | d1f809f14cad2c14c312767d71361c7f2e7d8244 (diff) | |
download | dotty-60d81f81ddfc85719fd303e8d15d3891adbf4dfd.tar.gz dotty-60d81f81ddfc85719fd303e8d15d3891adbf4dfd.tar.bz2 dotty-60d81f81ddfc85719fd303e8d15d3891adbf4dfd.zip |
Start new, direct HK scheme
- Re-introduce newHK option. Label some things that will be
removed with OLD.
Diffstat (limited to 'src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 3f3108ac2..27cc0e6f5 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -4,9 +4,10 @@ package typer import core._ import ast._ +import config.Config.newHK import Scopes._, Contexts._, Constants._, Types._, Symbols._, Names._, Flags._, Decorators._ import ErrorReporting._, Annotations._, Denotations._, SymDenotations._, StdNames._, TypeErasure._ -import TypeApplications.AppliedType +import TypeApplications.{AppliedType, TypeLambdaOLD} import util.Positions._ import config.Printers._ import ast.Trees._ @@ -426,14 +427,16 @@ trait TypeAssigner { tree.withType(ownType) } - def assignType(tree: untpd.TypeLambdaTree, tparamDefs: List[TypeDef], body: Tree)(implicit ctx: Context) = { - val tparams = tparamDefs.map(_.symbol) - val argBindingFns = tparams.map(tparam => - tparam.info.bounds - .withBindingKind(BindingKind.fromVariance(tparam.variance)) - .recursify(tparams)) - val bodyFn = body.tpe.recursify(tparams) - tree.withType(TypeApplications.TypeLambda(argBindingFns, bodyFn)) + def assignType(tree: untpd.TypeLambdaTree, tparamDefs: List[TypeDef], body: Tree)(implicit ctx: Context) = + if (newHK) tree.withType(TypeLambda.fromSymbols(tparamDefs.map(_.symbol), body.tpe)) + else { + val tparams = tparamDefs.map(_.symbol) + val argBindingFns = tparams.map(tparam => + tparam.info.bounds + .withBindingKind(BindingKind.fromVariance(tparam.variance)) + .recursifyOLD(tparams)) + val bodyFn = body.tpe.recursifyOLD(tparams) + tree.withType(TypeLambdaOLD(argBindingFns, bodyFn)) } def assignType(tree: untpd.ByNameTypeTree, result: Tree)(implicit ctx: Context) = |