Skip to content

Commit 1a30250

Browse files
committed
Make assigned types of inlined expressions InferredTypes
Otherwise we force purity where none might exist.
1 parent e104f8e commit 1a30250

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ class Inliner(val call: tpd.Tree)(using Context):
596596
val inlinedSingleton = singleton(t).withSpan(argSpan)
597597
inlinedFromOutside(inlinedSingleton)(tree.span)
598598
case Some(t) if tree.isType =>
599-
inlinedFromOutside(TypeTree(t).withSpan(argSpan))(tree.span)
599+
inlinedFromOutside(new InferredTypeTree().withType(t).withSpan(argSpan))(tree.span)
600600
case _ => tree
601601
}
602602
case tree @ Select(qual: This, name) if tree.symbol.is(Private) && tree.symbol.isInlineMethod =>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class ContextClass
2+
type Context = ContextClass^
3+
class ParamRef:
4+
def isTracked(using Context): Boolean = ???
5+
trait Lam[PR <: ParamRef]:
6+
val paramRefs: List[PR] = ???
7+
inline def atPhase[T]()(inline op: Context ?=> T)(using ctx: Context): T =
8+
op(using ctx)
9+
10+
def Test(using ctx: Context) =
11+
val info: Lam[ParamRef] = ???
12+
info.paramRefs.filter(_.isTracked)
13+
val p = atPhase()((_: ParamRef).isTracked)
14+
val _: ParamRef ->{ctx} Boolean = p
15+
16+
//val f: String => ParamRef = ???
17+
//val q = f.andThen(p)
18+

0 commit comments

Comments
 (0)