Skip to content

type system: declare the T field of TypeEq as Any - #62948

Open
KristofferC wants to merge 1 commit into
masterfrom
kc/typeeq-T-any
Open

KristofferC wants to merge 1 commit into
masterfrom
kc/typeeq-T-any

Conversation

@KristofferC

Copy link
Copy Markdown
Member

Not sure if this is the best way to solve this but opening anyway and @Keno can say what he thinks.

jl_valid_type_param admits non-type values as type parameters, so Type{1} and Type{setindex!} are constructible (as on 1.13), and subtyping can also produce such types by binding a typevar to a value. Declaring the field as Union{AnyType,TypeVar} let inference unsoundly devirtualize on the declared field type, so show dispatched a function value parameter to the TypeVar method and dereferenced it as one, segfaulting. Widen the declared field type to Any to match what construction actually admits (this also restores the inference behavior of the untyped .parameters access on 1.13), and make modulesof! tolerate a non-type parameter.

Fixes #62897


This change was written by Claude Code (Fable 5)

@KristofferC
KristofferC requested a review from Keno August 31, 2026 21:07
@KristofferC

Copy link
Copy Markdown
Member Author

Bump @Keno

`jl_valid_type_param` admits non-type values as type parameters, so
`Type{1}` and `Type{setindex!}` are constructible (as on 1.13), and
subtyping can also produce such types by binding a typevar to a value.
Declaring the field as `Union{AnyType,TypeVar}` let inference unsoundly
devirtualize on the declared field type, so `show` dispatched a function
value parameter to the `TypeVar` method and dereferenced it as one,
segfaulting. Widen the declared field type to `Any` to match what
construction actually admits (this also restores the inference behavior
of the untyped `.parameters` access on 1.13), and make `modulesof!`
tolerate a non-type parameter.

Fixes #62897

Assisted-by: Claude Code (Fable 5)
@vtjnash vtjnash added merge me PR is reviewed. When all tests are passing merge, making sure commit message is good. types and dispatch Types, subtyping and method dispatch labels Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge me PR is reviewed. When all tests are passing merge, making sure commit message is good. types and dispatch Types, subtyping and method dispatch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show of Type{f} with a function-value parameter segfaults

3 participants