Skip to content

Comments

Fix Issue 17908 - Can't alias an overload set with disabled function#7244

Merged
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:Issue_17908
Oct 27, 2017
Merged

Fix Issue 17908 - Can't alias an overload set with disabled function#7244
dlang-bot merged 1 commit intodlang:masterfrom
RazvanN7:Issue_17908

Conversation

@RazvanN7
Copy link
Contributor

Checking a disabled aliased symbol was done by calling the checkDeprecated function from the Dsymbol class. If the symbol was disabled, then an error was issued. I added the checking for functions in the same overload set. If an overload which is not disabled is found, then we're good, otherwise, issue error.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
17908 Can't alias an overload set with disabled function

void main()
{
g(10);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any use in this test case (also it's wrong ATM).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to make sure that changing the order of the declarations will not influence the result (in the original bug report, one workaround in the code would have been to change the order of the function declarations.)

Copy link
Member

Choose a reason for hiding this comment

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

@RazvanN7 it's simple to just put it in the same module as the other test - use a different name than foo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah putting them all in one file when possible is the recommended approach (more files == slower autotester).
If you test for the order of declaration, then it makes sense. Could you add a comment before the second test case when you move them together, so it's more obvious to the clueless reader ?
Also, any specific reasons some don't have a body ?

Copy link
Contributor Author

@RazvanN7 RazvanN7 Oct 27, 2017

Choose a reason for hiding this comment

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

Could you add a comment before the second test case when you move them together, so it's more obvious to the clueless reader ?

Sure thing.

Also, any specific reasons some don't have a body ?

No, it was just a slip on my part.

void main()
{
g(10);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test with one member of the overload set being disabled (out of two), and calling the disabled overload ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks for the tip

@andralex
Copy link
Member

cc @WalterBright

@RazvanN7 RazvanN7 force-pushed the Issue_17908 branch 2 times, most recently from 8dc2bee to 3f4b3b2 Compare October 27, 2017 08:56
return;
}
}
error(loc, "is not callable because it is annotated with @disable");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Indent is off


void foo();
@disable void foo(int) {}
alias g = foo;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also merge this file with the previous one, and add a body for foo ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On it.

@RazvanN7
Copy link
Contributor Author

@mathias-lang-sociomantic Thanks for the review. Hope that all is good now.

@mathias-lang-sociomantic
Copy link
Contributor

It looks like you messed up the test. There's two fail_compilation where there should only be one, and the compilable test disappeared.

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Oct 27, 2017

@mathias-lang-sociomantic You said to merge fail_compilation/test17908b.d with the previous one which could mean either the compilable one or fail_compilation/test17908a.b. I assumed it's the compilable one since if I merge the 2 fail compilation ones you get only the first error encountered, not both.

@d-random-contributor
Copy link

In test17908b only the third check should fail, the first two should pass - no test for the latter.

@mathias-lang-sociomantic
Copy link
Contributor

You said to merge fail_compilation/test17908b.d with the previous one which could mean either the compilable one or fail_compilation/test17908a.b. I assumed it's the compilable one since if I merge the 2 fail compilation ones you get only the first error encountered, not both.

Hum sorry I thought you'd get both failure. But it's probably better to keep them separated then (as before). Sorry for that!

@RazvanN7
Copy link
Contributor Author

@mathias-lang-sociomantic No probs, it was just a misunderstanding.

@mathias-lang-sociomantic
Copy link
Contributor

Hum Jenkins seems broken, I see that failure on other P.R. as well :(

@PetarKirov
Copy link
Member

Hum Jenkins seems broken, I see that failure on other P.R. as well :(

@mathias-lang-sociomantic yes because we had a regression in phobos. We fixed that problem in dlang/phobos#5816, so we should be good now.

@mathias-lang-sociomantic
Copy link
Contributor

And unsurprisingly, the CI was red but no attention was given to it. I hope it's made mandatory sooner than later.

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