-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Member defined in REPL should shadow previously imported member #4230
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
Comments
This has to do with the way we handle imports. When compiling an expression, we first import the previous wrapper objects and then the user defined imports. So currently, a definition imported with an import will always take precedence over one defined in a previous run |
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 8, 2018
We used to collect imports from the parsed tree and insert them as parsed trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 8, 2018
We used to collect imports from the parsed tree and insert them as parsed trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 21, 2018
We used to collect user defined imports from the parsed tree and insert them as untyped trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
nicolasstucki
pushed a commit
to dotty-staging/dotty
that referenced
this issue
Aug 22, 2018
We used to collect imports from the parsed tree and insert them as parsed trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 22, 2018
This reverts commit 5cbb512.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 22, 2018
We used to collect user defined imports from the parsed tree and insert them as untyped trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 22, 2018
We used to collect imports from the parsed tree and insert them as parsed trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 28, 2018
We used to collect user defined imports from the parsed tree and insert them as untyped trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions. This also fixes scala#4978 by having user defined import in the run context. Auto-completions somehow ignored them when they were part of the untyped tree.
allanrenucci
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 28, 2018
We used to collect user defined imports from the parsed tree and insert them as untyped trees at the top of the REPL wrapper object. This caused members shadowing issues. We now introduce a phase in the REPL compiler that collects imports after type checking and store them as typed tree. We can then create a context with its imports set in the correct order and use it to compile future expressions. This also fixes scala#4978 by having user defined import in the run context. Auto-completions somehow ignored them when they were part of the untyped tree.
allanrenucci
added a commit
that referenced
this issue
Sep 3, 2018
Fix #4230: Handle import in the REPL correctly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Below an (un)reproducible transcript of the REPL not handling shadowing correctly. After both importing and defining
f
, only the imported one is in scope.The text was updated successfully, but these errors were encountered: