Skip to content

Commit a10c7f7

Browse files
committed
Mark the type of lifted definitions as inferred
1 parent 620b08b commit a10c7f7

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ abstract class Lifter {
3737
protected def liftedFlags: FlagSet = EmptyFlags
3838

3939
/** The tree of a lifted definition */
40-
protected def liftedDef(sym: TermSymbol, rhs: Tree)(using Context): MemberDef = ValDef(sym, rhs)
40+
protected def liftedDef(sym: TermSymbol, rhs: Tree)(using Context): MemberDef =
41+
// Mark the type of lifted definitions as inferred
42+
ValDef(sym, rhs, inferred = true)
4143

4244
private def lift(defs: mutable.ListBuffer[Tree], expr: Tree, prefix: TermName = EmptyTermName)(using Context): Tree =
4345
if (noLift(expr)) expr
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import language.experimental.captureChecking
2+
3+
trait MyMap[K, V]:
4+
def filterNot(pred: ((K, V)) => Boolean): MyMap[K, V]^{this, pred} = ???
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait AttributeValue
2+
3+
case class CompletedSpan(
4+
name: String, // remove to make it compile
5+
attributes: MyMap[String, AttributeValue],
6+
){
7+
lazy val allAttributes: MyMap[String, AttributeValue] = attributes
8+
var allAttributes2: MyMap[String, AttributeValue] = attributes
9+
}
10+
11+
def Test =
12+
val span: CompletedSpan = ???
13+
span.copy(attributes = span.allAttributes.filterNot { _ => false })
14+
span.copy(attributes = span.allAttributes2.filterNot { _ => false })

0 commit comments

Comments
 (0)