-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #17667 account for import order #17951
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
Conversation
- Import in the same scope, but after the usage are reported. - Add test suit i17667 - Fix test i15503a
import collection.mutable.Set // ok | ||
import collection.mutable.Set // error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szymon-rd
I was just wondering about this one, it seems like this import is not required. It can be removed and still get the correct result : https://scastie.scala-lang.org/9pyvzVWyTAyBsOPduePhqg
Am I missing something ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you are correct. Some of these tests lay out the expected false negatives. If this is not a false negative, then great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I just left one comment, and could you fix the failing test?
@@ -349,7 +348,7 @@ object CheckUnused: | |||
* | |||
* See the `isAccessibleAsIdent` extension method below in the file | |||
*/ | |||
private val usedInScope = MutStack(MutSet[(Symbol,Boolean, Option[Name], Boolean)]()) | |||
private val usedInScope = MutStack(MutSet[(Symbol,Boolean, Option[Name], Boolean, Option[SrcPos])]()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make it a case class instead? This tuple got very long and hard to understand.
@PaulCoral Can I finish this PR? Or are you planning to come back to it? |
@szymon-rd Yes, sure! Sorry for this, I was stuck with this last test, which seems to be related to "derives" (again...). I don't think I will have time soon for this, so you can go for it. |
I think this stale PR can be retired. Tracking imports by source position does not seem like a natural approach. |
Closing due to inactivity. |
Fix #17667
An example to illustrate this :
This compiles:
This does NOT compile