Skip to content
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

Fix Issues 20530, 20537 - resolve trait isPackage/isModule and is(package/module) quirks #10745

Merged
merged 2 commits into from
Feb 11, 2020

Conversation

BorisCarvajal
Copy link
Member

…ork with string mixins

#10739 continuation.

I made two solutions to the issue of the last comment but hit another bug while trying the long alternative so I decided to put that version on another pull to fix that bug.

The short version here is changing something I wondered in the past why it was there, the typeToExpression call is unnecessary and it gave me different results a few times on compiler experiments when using mixin("ident . ident ...") vs plain code, it seems the way that TypeIdentifier is converted to DotIdExp makes the code behave different on some cases.

@dlang-bot
Copy link
Contributor

dlang-bot commented Jan 27, 2020

Thanks for your pull request and interest in making D better, @BorisCarvajal! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
11847 major sub-pkg not available as qualified name
20530 normal is(<...> == module/package) does not work with string mixins
20537 normal traits isPackage/isModule and is(package/module) fail on single level package.d import

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "stable + dmd#10745"

@Geod24
Copy link
Member

Geod24 commented Jan 27, 2020

@thewilsonator : Please don't auto-merge so quickly. There's no way you could have reviewed it in 2 minutes. I don't see the point of just merging without review. If we ever need this, we can just modify dlang-bot.
The previous solution had some issues, and was also prematurely merged before being reviewed. We might want to request a review from @MoonlightSentinel who actually did review and came up with good test cases last time.

@BorisCarvajal
Copy link
Member Author

@Geod24: the previous solution was merged because the original bug report didn't have enough test cases, I didn't know about the test cases provided by @MoonlightSentinel.
Just saying.

@MoonlightSentinel
Copy link
Contributor

@Geod24: the previous solution was merged because the original bug report didn't have enough test cases,

A bug report isn't required to show of all possible inputs reproducing a certain bug. You can always add more test cases, especially if you are not completely sure about your fix (based on your initial comment #10739 (comment))

I didn't know about the test cases provided by @MoonlightSentinel.

These tests were taken from compilable/test16002.d by changing all simple identifiers to string mixins. Searching for existing tests in the test suite is usually a good start to find missing test cases.

test/compilable/test20530b.d Outdated Show resolved Hide resolved
src/dmd/traits.d Outdated Show resolved Hide resolved
test/compilable/test20530b.d Outdated Show resolved Hide resolved
src/dmd/typesem.d Outdated Show resolved Hide resolved
@BorisCarvajal BorisCarvajal changed the title Fix Issue 20530 - second part. is(<...> == module/package) does not w… Fix Issues 20530, 20537 - resolve trait isPackage/isModule and is(package/module) quirks Jan 31, 2020
@BorisCarvajal
Copy link
Member Author

By the way, this patch also resolves the issue 11847. Should I link the bug and upload the test case?
There is already a pull (#7218) open for that issue that seems to cover more about it. Maybe I should ask @MartinNowak if this patch has the chance to close that issue or a part of it at least.

@thewilsonator
Copy link
Contributor

Should I link the bug and upload the test case?

Yes please.

src/dmd/dmodule.d Outdated Show resolved Hide resolved
src/dmd/dmodule.d Outdated Show resolved Hide resolved
Copy link
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved once definition of a "wrapper Package" is added.

@BorisCarvajal
Copy link
Member Author

I made the requested changes.

@thewilsonator
Copy link
Contributor

git clone -b v2.090.1 --depth=1 https://github.com/dlang/druntime .generated/druntime-2.090.1
Cloning into '.generated/druntime-2.090.1'...
warning: Could not find remote branch v2.090.1 to clone.
fatal: Remote branch v2.090.1 not found in upstream origin

Hmm, maybe try giving it a force push?

@BorisCarvajal
Copy link
Member Author

git clone -b v2.090.1 --depth=1 https://github.com/dlang/druntime .generated/druntime-2.090.1
Cloning into '.generated/druntime-2.090.1'...
warning: Could not find remote branch v2.090.1 to clone.
fatal: Remote branch v2.090.1 not found in upstream origin

Sounds like a script bug, there is no v2.090.1 tag yet, just v2.090.1-beta.1.

@thewilsonator
Copy link
Contributor

Hmm, maybe try rebasing? Otherwise I'll have to defer to @CyberShadow or someone else about that.

@BorisCarvajal
Copy link
Member Author

@thewilsonator, now I see the VERSION file was bumped but still no tag on dmd, druntime and phobos, I assume it's a matter of time.

@thewilsonator
Copy link
Contributor

Try giving it a force push, then I guess.

@dlang-bot dlang-bot merged commit fffe6be into dlang:stable Feb 11, 2020
kinke added a commit to kinke/dmd that referenced this pull request Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants