Skip to content

Commit 088d9ff

Browse files
committed
Avoid insertion of spurious applies when inlining
The test case crashed before, because it encuntered a selection with an inserted apply, which should be typed but was not. The fix prevents inserting the apply.
1 parent 95efbb1 commit 088d9ff

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ReTyper extends Typer {
3535

3636
override def typedSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = {
3737
assert(tree.hasType, tree)
38-
val qual1 = typed(tree.qualifier, AnySelectionProto)
38+
val qual1 = typed(tree.qualifier, selectionProto(tree.name, pt, this))
3939
untpd.cpy.Select(tree)(qual1, tree.name).withType(tree.typeOpt)
4040
}
4141

tests/pos/inline-apply.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Context
2+
3+
object Test {
4+
5+
def transform()(implicit ctx: Context) = {
6+
@inline def withLocalOwner[T](op: Context => T) = op(ctx)
7+
8+
withLocalOwner { implicit ctx => }
9+
10+
}
11+
}

0 commit comments

Comments
 (0)