Skip to content

Commit 545e737

Browse files
authored
Merge pull request #14046 from dotty-staging/fix-14039
Remove strong assertion when inlining
2 parents c83a29e + 36470b3 commit 545e737

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
15401540
inlineIfNeeded(tryInlineArg(tree.asInstanceOf[tpd.Tree]) `orElse` super.typedIdent(tree, pt))
15411541

15421542
override def typedSelect(tree: untpd.Select, pt: Type)(using Context): Tree = {
1543-
assert(tree.hasType, tree)
15441543
val qual1 = typed(tree.qualifier, shallowSelectionProto(tree.name, pt, this))
15451544
val resNoReduce = untpd.cpy.Select(tree)(qual1, tree.name).withType(tree.typeOpt)
15461545
val reducedProjection = reducer.reduceProjection(resNoReduce)

tests/neg-macros/i14039/Macro_1.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.*
2+
3+
object Macro:
4+
inline def apply(): Any = ${Macro.impl}
5+
6+
def impl(using Quotes): Expr[Any] =
7+
quotes.reflect.report.errorAndAbort("my message")

tests/neg-macros/i14039/Test_2.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Dsl {
2+
val entries = Seq.newBuilder[Any]
3+
inline def get(): Unit = entries += Macro.apply()
4+
def test = get() // error
5+
}

tests/neg/i14039.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Error: tests/neg/i14039.scala:4:14 ----------------------------------------------------------------------------------
2+
4 |def test = get() // error
3+
| ^^^^^
4+
| my error

tests/neg/i14039.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
val entries = Seq.newBuilder[Any]
2+
inline def error(): Any = compiletime.error("my error")
3+
inline def get(): Unit = entries += error()
4+
def test = get() // error

0 commit comments

Comments
 (0)