Skip to content

Commit 631449f

Browse files
committed
Mark result types of anonymous functions as InferredTypeTrees
1 parent f2cef0b commit 631449f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,11 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
458458
def AppliedTypeTree(tpt: Tree, arg: Tree)(implicit src: SourceFile): AppliedTypeTree =
459459
AppliedTypeTree(tpt, arg :: Nil)
460460

461-
def TypeTree(tpe: Type)(using Context): TypedSplice = TypedSplice(TypeTree().withTypeUnchecked(tpe))
461+
def TypeTree(tpe: Type)(using Context): TypedSplice =
462+
TypedSplice(TypeTree().withTypeUnchecked(tpe))
463+
464+
def InferredTypeTree(tpe: Type)(using Context): TypedSplice =
465+
TypedSplice(new InferredTypeTree().withTypeUnchecked(tpe))
462466

463467
def unitLiteral(implicit src: SourceFile): Literal = Literal(Constant(()))
464468

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,8 +1134,8 @@ class Typer extends Namer
11341134
*/
11351135
private def decomposeProtoFunction(pt: Type, defaultArity: Int, pos: SrcPos)(using Context): (List[Type], untpd.Tree) = {
11361136
def typeTree(tp: Type) = tp match {
1137-
case _: WildcardType => untpd.TypeTree()
1138-
case _ => untpd.TypeTree(tp)
1137+
case _: WildcardType => new untpd.InferredTypeTree()
1138+
case _ => untpd.InferredTypeTree(tp)
11391139
}
11401140
def interpolateWildcards = new TypeMap {
11411141
def apply(t: Type): Type = t match

0 commit comments

Comments
 (0)