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

Deprecate typesafe variadic class arguments #20673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Jan 9, 2025

Testing it as an error first to see if anything on buildkite relies on this feature.

@dkorpel dkorpel added the Review:WIP Work In Progress - not ready for review or pulling label Jan 9, 2025
@dlang-bot dlang-bot added the WIP label Jan 9, 2025
@dlang-bot
Copy link
Contributor

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

compiler/src/dmd/typesem.d Outdated Show resolved Hide resolved
compiler/src/dmd/typesem.d Outdated Show resolved Hide resolved
@dkorpel
Copy link
Contributor Author

dkorpel commented Jan 10, 2025

2 buildkite projects fail when it becomes an error:

ddox:

[main(----) INF] Generating module: test
+ '[' '!' -f .no_diff ']'
+ git --no-pager diff --exit-code -- docs
+ popd
~/rejectedsoftware-ddox
+ for dir in tests/*
+ pushd tests/issue177_variadic
~/rejectedsoftware-ddox/tests/issue177_variadic ~/rejectedsoftware-ddox
+ dmd -Xftest.json -Dd__dummy_html -c -o- test.d
test.d(19): Error: cannot have typesafe variadic parameter of class type `test.C`
void bug(scope C c...)
     ^
test.d(40): Error: cannot have typesafe variadic parameter of class type `test.C`
alias FT3 = void function(scope C c...);
^
test.d(55): Error: cannot have typesafe variadic parameter of class type `test.C`
void function(scope C c...) var3;

This is simply a test case for all kinds of typesafe variadic functions, easily removed.

dwt:

    Starting Performing "debug" build using /buildkite/builds/zaphod-4/dlang/dmd/buildkite-ci-build/distribution/bin/dmd for x86_64.
    Building dwt ~master: building configuration [linux-gtk]
base/src/java/lang/Class.d(42,17): Error: cannot have typesafe variadic parameter of class type `java.lang.Class.Class`
    Constructor getConstructor(Class parameterTypes...){
                ^
base/src/java/lang/Class.d(54,17): Error: cannot have typesafe variadic parameter of class type `java.lang.Class.Class`
    Constructor getDeclaredConstructor(Class parameterTypes...){
                ^
base/src/java/lang/Class.d(70,12): Error: cannot have typesafe variadic parameter of class type `java.lang.Class.Class`
    Method getDeclaredMethod(String name, Class parameterTypes...){
           ^
Error /buildkite/builds/zaphod-4/dlang/dmd/buildkite-ci-build/distribution/bin/dmd failed with exit code 1.

These 3 functions are stubs in root class Class that call implMissing, and are never overridden as far as I can see. Considering Class doesn't even have any fields, it's probably a typo, and meant to say Class[] parameterTypes....

@dkorpel dkorpel force-pushed the remove-typesafe-variadic-classes branch from 5a3b0e9 to 60a6ad3 Compare January 10, 2025 22:21
@dkorpel dkorpel added Review:Needs Changelog A changelog entry needs to be added to /changelog Review:Needs Approval and removed Review:WIP Work In Progress - not ready for review or pulling WIP labels Jan 10, 2025
@dkorpel dkorpel changed the title [WIP] Deprecate typesafe variadic class arguments Deprecate typesafe variadic class arguments Jan 10, 2025
Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

This otherwise looks good

compiler/src/dmd/typesem.d Outdated Show resolved Hide resolved
@dkorpel dkorpel force-pushed the remove-typesafe-variadic-classes branch from 60a6ad3 to f622eb9 Compare January 16, 2025 00:20
@dkorpel dkorpel removed the Review:Needs Changelog A changelog entry needs to be added to /changelog label Jan 16, 2025
@dkorpel dkorpel linked an issue Jan 16, 2025 that may be closed by this pull request
@dkorpel dkorpel marked this pull request as ready for review January 16, 2025 13:25
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.

Support struct in typesafe variadic function
3 participants