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

fix #44735, raise exception on Vararg-arguments in subtype rather than abort #44761

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

aviatesk
Copy link
Sponsor Member

No description provided.

@aviatesk aviatesk added the backport 1.8 Change should be backported to release-1.8 label Mar 27, 2022
@KristofferC KristofferC mentioned this pull request Mar 28, 2022
22 tasks
@aviatesk
Copy link
Sponsor Member Author

@vtjnash does this seem sensible to you?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 29, 2022

I am not precisely sure how Vararg works now, but seems probably safe. Seems like something that should be handled internally to type-intersection though, where other conditions are checked?

@aviatesk
Copy link
Sponsor Member Author

aviatesk commented Mar 29, 2022

yeah, if jl_type_intersection does really only expect Type-objects, I think it might be better to change the signature to typeintersect(@nospecialize(a::Type), @nospecialize(b::Type)), and remove the vararg assertion from jl_type_intersection?

EDIT: typeintersect should accept other arbitrary values also -- so nvm.

@aviatesk
Copy link
Sponsor Member Author

ok, now the exception would be raised within subtype.c.

@aviatesk aviatesk changed the title fix #44735, assert typeintersect arguments on Julia level fix #44735, raise exception on Vararg-arguments in subtype rather than abort Mar 30, 2022
@Keno
Copy link
Member

Keno commented Mar 30, 2022

IIRC @JeffBezanson felt pretty strongly that passing non-type object here is a bug and should assert, but maybe I'm misremembering. Regardless, we should check with him when he's back from vacation.

@JeffBezanson
Copy link
Sponsor Member

Right, I don't think subtype/intersection should need to throw any errors. Currently there is only one (circular type parameter constraint), and it's basically a misplaced type-definition-time check.

I think we wanted this assert after the TypeofVararg change to make sure we caught all the cases that treated it like a type. Now that it's been working for a while, I think we could just remove the assert and let it fall through to egal like all other random values. If we later want to add checks that the arguments to typeintersect at the julia level are Types, that might be ok too.

@aviatesk
Copy link
Sponsor Member Author

aviatesk commented Apr 6, 2022

Thanks @JeffBezanson for your comment. I removed the jl_is_vararg assertions from subtype.c, and also added Julia level assertions that checks if input arguments are Types.
I will try the inference benchmark: I will remove the Julia level error checks if benchmark result shows it can lead to some performance problem.

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@aviatesk
Copy link
Sponsor Member Author

aviatesk commented Apr 6, 2022

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

base/reflection.jl Outdated Show resolved Hide resolved
base/reflection.jl Outdated Show resolved Hide resolved
@aviatesk
Copy link
Sponsor Member Author

aviatesk commented Apr 7, 2022

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here.

@aviatesk
Copy link
Sponsor Member Author

aviatesk commented Apr 7, 2022

Seems good to go?

@aviatesk aviatesk merged commit 6d78404 into master Apr 8, 2022
@aviatesk aviatesk deleted the avi/44735 branch April 8, 2022 01:42
aviatesk added a commit that referenced this pull request Apr 8, 2022
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label May 26, 2022
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.

6 participants