Skip to content

Commit 0383ba4

Browse files
committed
Drop call to markPathFree in typedSelection
The idea of markPathFree is that we should only apply it to leave nodes.
1 parent 186df5e commit 0383ba4

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ class CheckCaptures extends Recheck, SymTransformer:
710710
*/
711711
override def selectionProto(tree: Select, pt: Type)(using Context): Type =
712712
val sym = tree.symbol
713-
if !sym.isOneOf(UnstableValueFlags) && !sym.isStatic
713+
if !sym.isOneOf(MethodOrLazyOrMutable) && !sym.isStatic
714714
|| sym.isReadOnlyMethod
715715
then PathSelectionProto(tree, pt)
716716
else super.selectionProto(tree, pt)
@@ -759,14 +759,6 @@ class CheckCaptures extends Recheck, SymTransformer:
759759
|lazy val initializers should only access non-local capabilities in a read-only fashion.""",
760760
tree.srcPos)
761761

762-
// If selecting a lazy val member, charge the qualifier since accessing
763-
// the lazy val can trigger initialization that uses the qualifier's capabilities
764-
if tree.symbol.is(Lazy) then
765-
qualType match
766-
case tr: (TermRef | ThisType) =>
767-
markPathFree(tr, pt, tree)
768-
case _ =>
769-
770762
val origSelType = recheckSelection(tree, qualType, name, disambiguate)
771763
val selType = mapResultRoots(origSelType, tree.symbol)
772764
val selWiden = selType.widen

0 commit comments

Comments
 (0)