aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/EtaExpansion.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala2
-rw-r--r--src/dotty/tools/dotc/typer/RefChecks.scala9
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala39
4 files changed, 19 insertions, 33 deletions
diff --git a/src/dotty/tools/dotc/typer/EtaExpansion.scala b/src/dotty/tools/dotc/typer/EtaExpansion.scala
index 397b6d95b..c390ae808 100644
--- a/src/dotty/tools/dotc/typer/EtaExpansion.scala
+++ b/src/dotty/tools/dotc/typer/EtaExpansion.scala
@@ -138,7 +138,7 @@ object EtaExpansion {
if (mt.paramTypes.length == xarity) mt.paramTypes map (_ => TypeTree())
else mt.paramTypes map TypeTree
val params = (mt.paramNames, paramTypes).zipped.map((name, tpe) =>
- ValDef(name, TypeTree(tpe), EmptyTree).withFlags(Synthetic | Param).withPos(tree.pos))
+ ValDef(name, tpe, EmptyTree).withFlags(Synthetic | Param).withPos(tree.pos))
var ids: List[Tree] = mt.paramNames map (name => Ident(name).withPos(tree.pos))
if (mt.paramTypes.nonEmpty && mt.paramTypes.last.isRepeatedParam)
ids = ids.init :+ repeated(ids.last)
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 00e92cbfb..9da0e2edc 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -927,7 +927,7 @@ class Namer { typer: Typer =>
val tptProto = mdef.tpt match {
case _: untpd.DerivedTypeTree =>
WildcardType
- case TypeTree(untpd.EmptyTree) =>
+ case TypeTree() =>
inferredType
case TypedSplice(tpt: TypeTree) if !isFullyDefined(tpt.tpe, ForceDegree.none) =>
val rhsType = typedAheadExpr(mdef.rhs, tpt.tpe).tpe
diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala
index 4d82a2d12..a2bb9b8d0 100644
--- a/src/dotty/tools/dotc/typer/RefChecks.scala
+++ b/src/dotty/tools/dotc/typer/RefChecks.scala
@@ -851,15 +851,6 @@ class RefChecks extends MiniPhase { thisTransformer =>
tree
}
- override def transformTypeTree(tree: TypeTree)(implicit ctx: Context, info: TransformerInfo) = {
- if (!tree.original.isEmpty)
- tree.tpe.foreachPart {
- case tp: NamedType => checkUndesiredProperties(tp.symbol, tree.pos)
- case _ =>
- }
- tree
- }
-
override def transformIdent(tree: Ident)(implicit ctx: Context, info: TransformerInfo) = {
checkUndesiredProperties(tree.symbol, tree.pos)
currentLevel.enterReference(tree.symbol, tree.pos)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 6be119319..f6d53f1e2 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -961,28 +961,23 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree = track("typedTypeTree") {
- if (tree.original.isEmpty)
- tree match {
- case tree: untpd.DerivedTypeTree =>
- tree.ensureCompletions
- try
- TypeTree(tree.derivedType(tree.attachment(untpd.OriginalSymbol))) withPos tree.pos
- // btw, no need to remove the attachment. The typed
- // tree is different from the untyped one, so the
- // untyped tree is no longer accessed after all
- // accesses with typedTypeTree are done.
- catch {
- case ex: NoSuchElementException =>
- println(s"missing OriginalSymbol for ${ctx.owner.ownersIterator.toList}")
- throw ex
- }
- case _ =>
- assert(isFullyDefined(pt, ForceDegree.none))
- tree.withType(pt)
- }
- else {
- val original1 = typed(tree.original)
- cpy.TypeTree(tree)(original1).withType(original1.tpe)
+ tree match {
+ case tree: untpd.DerivedTypeTree =>
+ tree.ensureCompletions
+ try
+ TypeTree(tree.derivedType(tree.attachment(untpd.OriginalSymbol))) withPos tree.pos
+ // btw, no need to remove the attachment. The typed
+ // tree is different from the untyped one, so the
+ // untyped tree is no longer accessed after all
+ // accesses with typedTypeTree are done.
+ catch {
+ case ex: NoSuchElementException =>
+ println(s"missing OriginalSymbol for ${ctx.owner.ownersIterator.toList}")
+ throw ex
+ }
+ case _ =>
+ assert(isFullyDefined(pt, ForceDegree.none))
+ tree.withType(pt)
}
}