Skip to content

[dclass.d] deduplicate logic for checking reserved classes - #21731

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
thewilsonator:class-ctor
Aug 21, 2025
Merged

thewilsonator merged 1 commit into
dlang:masterfrom
thewilsonator:class-ctor

Conversation

@thewilsonator

Copy link
Copy Markdown
Contributor

No description provided.

@dlang-bot

Copy link
Copy Markdown

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

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#21731"

@thewilsonator

Copy link
Copy Markdown
Contributor Author

dmd/compiler/src/dmd/dclass.d(239:13)[warn]: a virtual call inside a constructor may lead to unexpected results in the derived classes

I presume this is a fault with dscanner, that function is local. dlang-community/D-Scanner#968

@thewilsonator
thewilsonator force-pushed the class-ctor branch 2 times, most recently from 63d1cf3 to 15f54c8 Compare August 19, 2025 14:40
Comment thread compiler/src/dmd/dclass.d
Comment on lines -266 to -271
if (id == Id.TypeInfo_StaticArray)
{
//if (!inObject)
// Type.typeinfostaticarray.classError("%s `%s` %s", msg);
Type.typeinfostaticarray = this;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know why this was originally commented out:

class TypeInfo_StaticArray {}
class TypeInfo_Array {}
void main() {}

yields

testtisa.d(2): Error: class `testtisa.TypeInfo_StaticArray` already exists at object.d(979). Perhaps in another function with the same name?
testtisa.d(3): Error: class `TypeInfo_Array` only object.d can define this reserved class name

and errors anyway.

@thewilsonator
thewilsonator requested a review from dkorpel August 19, 2025 15:30
@thewilsonator
thewilsonator merged commit eeb9f29 into dlang:master Aug 21, 2025
39 of 44 checks passed
@thewilsonator
thewilsonator deleted the class-ctor branch August 21, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants