Bug 20742 – dmd -X (JSON output) includes uncompiled symbols

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-16T20:39:48Z
Last change time
2020-04-20T11:01:31Z
Keywords
ddoc, json, pull
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2020-04-16T20:39:48Z
--- a.d version(Showme) private struct X {} version(none) struct Y {} --- dmd -X -c a.d cat a.json [ { "kind" : "module", "file" : "a.d", "members" : [ { "name" : "X", "kind" : "struct", "line" : 1, "char" : 25, "members" : [] }, { "name" : "Y", "kind" : "struct", "line" : 2, "char" : 15, "members" : [] } ] } ] ----- dmd -c -X -version=Showme a.d cat a.json [ { "kind" : "module", "file" : "a.d", "members" : [ { "name" : "X", "kind" : "struct", "protection" : "private", "line" : 1, "char" : 25, "members" : [] }, { "name" : "X", "kind" : "struct", "protection" : "private", "line" : 1, "char" : 25, "members" : [] }, { "name" : "Y", "kind" : "struct", "line" : 2, "char" : 15, "members" : [] } ] } ] ---- Note a few things here: 1. The "private" is not shown for X unless the struct is included, which makes it doubly bad. 2. The when the version is selected, it comes out twice 3. There is no way to turn on version(none). This is wreaking havoc with ddox-like tools that depend on the json file (yes, versioned out documentation comes through too). I don't know the regression version, but at least 2.077.1 does not do this.
Comment #1 by moonlightsentinel — 2020-04-16T23:18:14Z
Digger found this commit: commit fd88fd097e1828b42de222eb5203b77b782b74b8 Author: Andrei Alexandrescu <[email protected]> Date: Mon Oct 30 13:05:15 2017 -0400 dmd: Merge pull request #6621 from yshui/jsonddoc https://github.com/dlang/dmd/pull/6621 Fix inconsistency between JSON output and ddoc output
Comment #2 by schveiguy — 2020-04-17T14:24:41Z
Thanks! Ironically, the original fix was added to "fix" ddox. And now I'm encountering this bug in ddox. I think there seems to have been a discrepancy in ddoc vs. the json output, but the fix seems to be overzealous. I'll see if I can play with it to figure out the right balance, but I might need help.
Comment #3 by moonlightsentinel — 2020-04-17T14:27:08Z
(In reply to Steven Schveighoffer from comment #2) > Thanks! Ironically, the original fix was added to "fix" ddox. And now I'm > encountering this bug in ddox. > > I think there seems to have been a discrepancy in ddoc vs. the json output, > but the fix seems to be overzealous. > > I'll see if I can play with it to figure out the right balance, but I might > need help. I've got a (partial) fix, will open a PR.
Comment #4 by schveiguy — 2020-04-17T14:40:52Z
(In reply to moonlightsentinel from comment #3) > I've got a (partial) fix, will open a PR. Thanks, I'll wait for that, and then I will help if I can.
Comment #5 by dlang-bot — 2020-04-17T15:11:49Z
@MoonlightSentinel created dlang/dmd pull request #11044 "Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols" fixing this issue: - Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols PR #6621 took the code for pending `ConditionalDeclaration`s from doc.d but missed the early return. https://github.com/dlang/dmd/pull/11044
Comment #6 by dlang-bot — 2020-04-20T11:01:31Z
dlang/dmd pull request #11044 "Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols" was merged into stable: - d02acc9866de69dca9e81d5229d3a982adc41b28 by MoonlightSentinel: Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols PR #6621 took the code for pending `ConditionalDeclaration`s from doc.d but missed the early return. https://github.com/dlang/dmd/pull/11044