Skip to content

Commit fee817d

Browse files
authored
Merge pull request #13012 from dotty-staging/simplify-typedAhead
Simplify typedAhead methods
2 parents 147e9ba + bf6e58a commit fee817d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,14 +1394,10 @@ class Namer { typer: Typer =>
13941394
}
13951395

13961396
def typedAheadType(tree: Tree, pt: Type = WildcardType)(using Context): tpd.Tree =
1397-
inMode(ctx.mode &~ Mode.PatternOrTypeBits | Mode.Type) {
1398-
typedAhead(tree, typer.typed(_, pt))
1399-
}
1397+
typedAhead(tree, typer.typedType(_, pt))
14001398

14011399
def typedAheadExpr(tree: Tree, pt: Type = WildcardType)(using Context): tpd.Tree =
1402-
withoutMode(Mode.PatternOrTypeBits) {
1403-
typedAhead(tree, typer.typed(_, pt))
1404-
}
1400+
typedAhead(tree, typer.typedExpr(_, pt))
14051401

14061402
def typedAheadAnnotation(tree: Tree)(using Context): tpd.Tree =
14071403
typedAheadExpr(tree, defn.AnnotationClass.typeRef)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2959,7 +2959,7 @@ class Typer extends Namer
29592959
def typedExpr(tree: untpd.Tree, pt: Type = WildcardType)(using Context): Tree =
29602960
withoutMode(Mode.PatternOrTypeBits)(typed(tree, pt))
29612961
def typedType(tree: untpd.Tree, pt: Type = WildcardType)(using Context): Tree = // todo: retract mode between Type and Pattern?
2962-
withMode(Mode.Type)(typed(tree, pt))
2962+
withMode(Mode.Type) { typed(tree, pt) }
29632963
def typedPattern(tree: untpd.Tree, selType: Type = WildcardType)(using Context): Tree =
29642964
withMode(Mode.Pattern)(typed(tree, selType))
29652965

0 commit comments

Comments
 (0)