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

Merged
merged 1 commit into from
Feb 16, 2025

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"

@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

@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
@dkorpel dkorpel force-pushed the remove-typesafe-variadic-classes branch from f622eb9 to a0f7663 Compare February 16, 2025 19:48
@dkorpel
Copy link
Contributor Author

dkorpel commented Feb 16, 2025

Walter and Atila approved this in an email, but Walter requested to not break code and keep it as legacy feature, so I removed the comment to make it an error in 2.121.

@dkorpel dkorpel merged commit 961862c into dlang:master Feb 16, 2025
39 of 42 checks passed
@dkorpel dkorpel deleted the remove-typesafe-variadic-classes branch February 16, 2025 20:35
@Herringway
Copy link
Contributor

If there's no plans to remove it, then call it what it is. A warning.

@dkorpel
Copy link
Contributor Author

dkorpel commented Feb 16, 2025

There used to be a -wo switch warning about obsolete features, but it has been superseded by editions. The DIP for that still needs to reach formal assessment, so currently there's no 'correct' way to mark this feature. Considering only 1 (accidental, stub) use is found on buildkite, I don't think it matters here.

@Herringway
Copy link
Contributor

There used to be a -wo switch warning about obsolete features, but it has been superseded by editions. The DIP for that still needs to reach formal assessment, so currently there's no 'correct' way to mark this feature. Considering only 1 (accidental, stub) use is found on buildkite, I don't think it matters here.

The correct way is an error or nothing at all. Editions don't exist, and therefore should not factor into this decision.

@dkorpel
Copy link
Contributor Author

dkorpel commented Feb 16, 2025

I'm in favor of turning it into an error, maybe Walter changes his mind 10 releases later.

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.

Deprecate typesafe variadic class arguments
4 participants