Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Mark the type of lifted definitions as inferred
  • Loading branch information
noti0na1 committed Sep 28, 2025
commit a10c7f7be1a0d2ecacaf4a0252f34ca72be35b37
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ abstract class Lifter {
protected def liftedFlags: FlagSet = EmptyFlags

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

private def lift(defs: mutable.ListBuffer[Tree], expr: Tree, prefix: TermName = EmptyTermName)(using Context): Tree =
if (noLift(expr)) expr
Expand Down
4 changes: 4 additions & 0 deletions tests/pos-custom-args/captures/i24101/S1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import language.experimental.captureChecking

trait MyMap[K, V]:
def filterNot(pred: ((K, V)) => Boolean): MyMap[K, V]^{this, pred} = ???
14 changes: 14 additions & 0 deletions tests/pos-custom-args/captures/i24101/S2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
trait AttributeValue

case class CompletedSpan(
name: String, // remove to make it compile
attributes: MyMap[String, AttributeValue],
){
lazy val allAttributes: MyMap[String, AttributeValue] = attributes
var allAttributes2: MyMap[String, AttributeValue] = attributes
}

def Test =
val span: CompletedSpan = ???
span.copy(attributes = span.allAttributes.filterNot { _ => false })
span.copy(attributes = span.allAttributes2.filterNot { _ => false })
Loading