Skip to content

Commit 82155ed

Browse files
committed
Recurse through blocks in inlineCall
1 parent a8240f8 commit 82155ed

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ object Inlines:
113113

114114
if tree.symbol.isConstructor then return tree // error already reported for the inline constructor definition
115115

116+
tree match
117+
case Block(bindings, expr) =>
118+
return cpy.Block(tree)(bindings, inlineCall(expr))
119+
case _ =>
120+
()
121+
116122
/** Set the position of all trees logically contained in the expansion of
117123
* inlined call `call` to the position of `call`. This transform is necessary
118124
* when lifting bindings from the expansion to the outside of the call.

tests/neg/i18123b.check

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- [E007] Type Mismatch Error: tests/neg/i18123b.scala:8:8 -------------------------------------------------------------
2+
8 |def z = y.rep().toUpperCase // error
3+
| ^^^^^^^
4+
| Found: (??? : => Nothing)
5+
| Required: ?{ toUpperCase: ? }
6+
| Note that implicit conversions were not tried because the result of an implicit conversion
7+
| must be more specific than ?{ toUpperCase: <?> }
8+
|
9+
| longer explanation available when compiling with `-explain`

tests/neg/i18123b.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Minimized version of `tests/pos/i18123.scala` to test #24425.
2+
3+
extension (x: String)
4+
transparent inline def rep(min: Int = 0): String = ???
5+
6+
def y: String = ???
7+
8+
def z = y.rep().toUpperCase // error

0 commit comments

Comments
 (0)