Bug 15857 – incorrect checkimports mismatch for overload sets

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-31T19:31:00Z
Last change time
2016-11-04T09:05:07Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
doob

Comments

Comment #0 by doob — 2016-03-31T19:31:07Z
Here's an other issue with the -transition=checkimports flag. I've not been able to create a reduced test case but I get the following error message when compiling DStep: clang/Type.d(114,24): Deprecation: local import search method found overloadset clang.Type.isEmpty instead of overloadset clang.Type.isEmpty This is where it complains [1], "isEmpty" pulled in from here [2] and declared here [3]. [1] https://github.com/jacob-carlborg/dstep/blob/master/clang/Type.d#L114 [2] https://github.com/jacob-carlborg/dstep/blob/master/clang/Type.d#L9 [3] https://github.com/jacob-carlborg/mambo/blob/master/mambo/core/Array.d#L110
Comment #1 by code — 2016-04-01T10:04:20Z
Comment #2 by code — 2016-04-02T11:04:51Z
Unfortunately we don't have any complete symbol equality test in the compiler (even __traits(isSame) doesn't completely work), so fixing this bug is a bit out of scope.
Comment #3 by doob — 2016-04-02T11:49:51Z
I guess since this is currently only a deprecation it isn't _that_ bad. Would it be realistic to fix the bug before it's turned in to a real error? What is considered equality for a symbol, the fully qualified name? Can that be used instead of comparing identity? Is there a workaround that I can use?
Comment #4 by code — 2016-04-05T20:41:46Z
(In reply to Jacob Carlborg from comment #3) > I guess since this is currently only a deprecation it isn't _that_ bad. > Would it be realistic to fix the bug before it's turned in to a real error? We'll remove the option when the old import rules have been deprecated. But sure we can try to add it later, in particular b/c __traits(isSame) doesn't work either. > What is considered equality for a symbol, the fully qualified name? Can that > be used instead of comparing identity? Comparing overload sets is a bit more complex, they are created during lookup and depend on the imported modules. > Is there a workaround that I can use? None that I'm aware of.
Comment #5 by k.hara.pg — 2016-04-17T15:44:31Z
I found a minimal test case to be able to see the message "Deprecation: local import search method found overloadset ... instead of overloadset ..." template Mix15857(T) { void foo15857(T) {} } mixin Mix15857!int; mixin Mix15857!string; void test15857() { foo15857(1); } (This is using template mixin instead of module import to reduce test files) However yet I'm not sure it will actually fix the original problem. https://github.com/dlang/dmd/pull/5681
Comment #6 by github-bugzilla — 2016-04-17T21:45:12Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/082e1199c258e99f7867ca33509db9ae9a31f3ae Issue 15857 - incorrect checkimports mismatch for overload sets Cache the generated `OverloadSet` object into scope, and prevent repetition of identical objects. https://github.com/dlang/dmd/commit/82c5682edbd876767d3853bd6fdd2cc70ebfa73b Merge pull request #5681 from 9rnsr/fix15857 Issue 15857 - incorrect checkimports mismatch for overload sets
Comment #7 by github-bugzilla — 2016-04-28T00:55:19Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/082e1199c258e99f7867ca33509db9ae9a31f3ae Issue 15857 - incorrect checkimports mismatch for overload sets https://github.com/dlang/dmd/commit/82c5682edbd876767d3853bd6fdd2cc70ebfa73b Merge pull request #5681 from 9rnsr/fix15857
Comment #8 by doob — 2016-05-30T14:35:19Z
This is not fixed in v2.071.1-b2.
Comment #9 by code — 2016-08-12T04:33:19Z
(In reply to Jacob Carlborg from comment #8) > This is not fixed in v2.071.1-b2. Are you sure? The merge is in v2.071.1-b1.
Comment #10 by doob — 2016-08-12T07:02:36Z
(In reply to Martin Nowak from comment #9) > (In reply to Jacob Carlborg from comment #8) > > This is not fixed in v2.071.1-b2. > > Are you sure? The merge is in v2.071.1-b1. I can give it another try.
Comment #11 by doob — 2016-08-12T09:19:07Z
(In reply to Martin Nowak from comment #9) > (In reply to Jacob Carlborg from comment #8) > > This is not fixed in v2.071.1-b2. > > Are you sure? The merge is in v2.071.1-b1. The issue persists with both 2.071.1 and 2.071.2-b2. The code base has gone through some major changes but I still get this error: clang/TranslationUnit.d(112,16): Deprecation: local import search method found overloadset clang.TranslationUnit.toD instead of overloadset clang.TranslationUnit.toD clang/TranslationUnit.d(266,42): Deprecation: local import search method found overloadset clang.TranslationUnit.toD instead of overloadset clang.TranslationUnit.toD clang/TranslationUnit.d(267,50): Deprecation: local import search method found overloadset clang.TranslationUnit.toD instead of overloadset clang.TranslationUnit.toD
Comment #12 by code — 2016-09-14T22:46:59Z
Looks like the caching fails for imports because of this https://github.com/dlang/dmd/blob/82c5682edbd876767d3853bd6fdd2cc70ebfa73b/src/dsymbol.d#L1283 condition.
Comment #13 by code — 2016-09-16T07:15:51Z
Comment #14 by github-bugzilla — 2016-09-16T22:04:16Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c5822394c89c98a8855302164433acf6db09208b fix Issue 15857 - incorrect checkimports mismatch for overloadsets - properly fix Issue 15857 by comparing overload sets for equality (see 082e1199c258e99f7867ca33509db9ae9a31f3ae or #5681 for the previous fix) - caching them in the local symbol table doesn't fully fix the issue b/c the table is not checked w/ SearchImportsOnly (see added test case) - also with -transition=checkimports adding an overload set to the local symbol table will return that overload set for locals only searches, even though it might contain imported overloads (see readded dip22e deprecation) - might still make sense to correctly cache overload sets at some point, but they shouldn't be that common https://github.com/dlang/dmd/commit/9ef10b73175ffb5ba6c638eef77bcdb243115026 Merge pull request #6136 from MartinNowak/fix15857 fix Issue 15857 - incorrect checkimports mismatch for overloadsets
Comment #15 by github-bugzilla — 2016-09-27T04:01:25Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c5822394c89c98a8855302164433acf6db09208b fix Issue 15857 - incorrect checkimports mismatch for overloadsets https://github.com/dlang/dmd/commit/9ef10b73175ffb5ba6c638eef77bcdb243115026 Merge pull request #6136 from MartinNowak/fix15857
Comment #16 by github-bugzilla — 2016-11-04T09:05:07Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/c5822394c89c98a8855302164433acf6db09208b fix Issue 15857 - incorrect checkimports mismatch for overloadsets https://github.com/dlang/dmd/commit/9ef10b73175ffb5ba6c638eef77bcdb243115026 Merge pull request #6136 from MartinNowak/fix15857