-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3736: Fix owner checking logic #3739
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
LGTM but I'd like @odersky to double-check this one. |
It's not possible to remove the test as in the original PR because otherwise e.g.
would also count. The logic of |
@@ -292,16 +292,16 @@ trait TypeOps { this: Context => // TODO: Make standalone object. | |||
if (!sym.exists || (sym eq defn.LanguageModuleClass)) "" | |||
else toPrefix(sym.owner) + sym.name + "." | |||
def featureName = toPrefix(owner) + feature | |||
def hasImport(implicit ctx: Context): Boolean = { | |||
if (ctx.importInfo == null || (ctx.importInfo.site.widen.typeSymbol ne owner)) false | |||
else if (ctx.importInfo.excluded.contains(feature)) false |
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.
Previously, we stopped and returned false for an unimported feature, but we now continue looking up the chain for an import, this breaks the last three errors in the neg test https://github.com/lampepfl/dotty/blob/master/tests/neg/dynamicNoImport.scala
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.
Yes, indeed, the logic is quite subtle here (and it was not documented either).
756ba2b
to
a4eb251
Compare
a4eb251
to
51498d2
Compare
Reimplemented fix without removing the importInfo owner check
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.
This is almost right, but the comment says that renamed features still count as import. In the logic here they are counted as un-imports.
No description provided.