Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Jul 5, 2021

There are two modes for finding default getters. They depend on whether
the receiver is defined or not. If the receiver is not defined we search
the enclosing scopes instead. This fails if the method and the call are in different
toplevel files, since the scopes of the two are not enclosing. But that should
not matter since for toplevel definitions we do have a defined receiver, namely
the synthetic enclosing object. Only for extension methods it happened that
that object was referred to via a This reference instead of a TermRef. This is
allowed in general but fell through a missing case in this instance.

Fixes #12897

There are two modes for finding default getters. They depend on whether
the receiver is defined or not. If the receiver is not defined we search
the enclosing scopes instead. This fails if the method and the call are in different
toplevel files, since the scopes of the two are not enclosing. But that should
not matter since for toplevel definitions we do have a defined receiver, namely
the synthetic enclosing object. Only for extension methods it happened that
that object was referred to via a This reference instead of a TermRef. This is
allowed in general but fell through a missing case in this instance.

Fixes scala#12897
@odersky odersky requested a review from smarter July 6, 2021 10:29
@odersky odersky assigned odersky and unassigned odersky Jul 6, 2021
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.

Extension method default argument value lost across files

3 participants