Skip to content

reduce name collisions #10425

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

Closed
aappddeevv opened this issue Nov 20, 2020 · 3 comments
Closed

reduce name collisions #10425

aappddeevv opened this issue Nov 20, 2020 · 3 comments

Comments

@aappddeevv
Copy link

Minimized example

trait Props extends js.Object { var basename: js.UndefOr[String] = js.undefined }

def basename(bname: js.UndefOr[String], children: ReactNode*) =
   createElement(JS, new Props { basename = bname }, children: _*)

Output

 [error] |Reference to basename is ambiguous

Expectation

Expectation is that this error should only occur if the name collision is because the name can be assigned to. Otherwise, it should assume that basename belongs to the data structure.

@prolativ
Copy link
Contributor

Minimized without external dependencies:

trait Props { var basename: String = "" }
def basename(bname: String) = new Props { basename = bname }

@smarter do we want this to work without thisbasename = bname? You mentioned on gitter that dotty had got somehow stricter in such cases compared to scala2.

@smarter
Copy link
Member

smarter commented Nov 23, 2020

Yes, we're intentional stricter since #8622, but it's possible we could still get this example to work since only one of the two basename in scope are setters.

@odersky
Copy link
Contributor

odersky commented Dec 26, 2020

I'd rather not complicate the pec with fine-grained distinctions like that.

@odersky odersky closed this as completed Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants