Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tighten closure extractor in TreeInfo #21621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 20, 2024

The previous extractor for closures matches also arbitrary blocks that ended in a (possible deeply nested) closure. This caused wrong use sets in #21620. The new definition is stricter. There is also a new blockEndingInclosure extractor that keeps the old behavior.

Fixes #21620

The previous extractor for closures matches also arbitrary blocks that ended in a
(possible deeply nested) closure. This caused wrong use sets in scala#21620. The new
definition is stricter. There is also a new blockEndingInclosure extractor that
keeps the old behavior.

Fixes scala#21620
@@ -814,17 +814,31 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
case _ => false
}

/** An extractor for closures, either contained in a block or standalone.
/** An extractor for closures, possibly typed, and possibly including the
* definition of the ananonymous def.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... the definition of an anonymous def or the anonymous def?

Copy link
Contributor Author

@odersky odersky Sep 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the def that corresponds to the closure node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* definition of the ananonymous def.
* definition of the anonymous def.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Captures of curried function are incorrectly dropped
2 participants