dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Disallow qualified types in base class list

Open Bolpat opened this issue 1 year ago • 1 comments

Currently, it is allowed that a base class is a qualified type.

class C : const(Object) { }
auto obj = new class const(Object) { };

The qualifier is ignored. For that reason, this change makes it a parse error, so no code fools a reader into thinking the const does something. Semantics are unaffected, i.e. if a typeof type is used which ends up being a qualified class type, the unqualified version of that class type remains a base class (no error).

The assumption of this PR is that no-one actually has qualified base classes in their code base (because the qualifier does nothing but mislead the reader).

It is in the interest of the Primary Type Syntax DIP and possibly future tuple DIPs to avoid parsing ambiguities. This can be done by requiring the base class list to be lexically comprised of new-terminology basic types. Refer to the accompanying spec PR for details.

Bolpat avatar Sep 26 '24 02:09 Bolpat

Thanks for your pull request and interest in making D better, @Bolpat! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

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

dub run digger -- build "master + dmd#16882"

dlang-bot avatar Sep 26 '24 02:09 dlang-bot

Does this fix an issue?

I filed one now. I hope it’s okay that I just put it in the most recent commit message.

Bolpat avatar Feb 14 '25 00:02 Bolpat

The CircleCI fails due to the (I guess usual) Error: template instance core.stdc.config._Complex!double cannot resolve forward reference. I don’t know why Main / FreeBSD 13.2 x64, DMD (bootstrap) (pull_request) fails.

Bolpat avatar Feb 20 '25 12:02 Bolpat

Error: The action 'Run in VM' has timed out after 14 minutes.

Timeout

thewilsonator avatar Feb 20 '25 12:02 thewilsonator

Error: The action 'Run in VM' has timed out after 14 minutes.

Timeout

I realized a merge was needed anyways. Generally speaking, if a timeout is the reason it failed, should I do a force push to re-do the tests?

Bolpat avatar Feb 20 '25 13:02 Bolpat