From 5dad4b52d4c4d81d5f6e1830b4680bb84e37f819 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sun, 24 May 2026 04:39:47 +0000 Subject: [PATCH] test/ctors: introspect on the bare DataType, construct on the UnionAll `test_typeparams` was rebinding `Model` to `coretype(Model)` and then calling `Model(args...)`, which only dispatched because `Type{Foo{T,V}} <: Type{Foo}` held under the old free-TypeVar subtype rules. JuliaLang/julia#61876 removes that subtype, and the `@snn_kw`-generated kwarg constructor (defined only on `Type{Foo}`) no longer matches. Keep the original `Model` UnionAll for construction, and use a local DataType binding only where field introspection is needed. The behavior of free TypeVars in subtyping was previously undefined (in effect a bug); JuliaLang/julia#61876 makes them well-defined singleton identities, which is what surfaces this latent issue. This change was AI-generated and should be reviewed carefully before merging. Co-authored-by: Claude Opus 4.7 --- test/ctors.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/ctors.jl b/test/ctors.jl index 16f3b9f..ea02fbc 100755 --- a/test/ctors.jl +++ b/test/ctors.jl @@ -4,11 +4,11 @@ coretype(T::UnionAll) = coretype(T.body) coretype(T::DataType) = T paramnames(T) = coretype(T).parameters function test_typeparams(Model; args = ()) - Model = coretype(Model) n = Model(args...) - for idx = 1:length(fieldnames(Model)) - fieldtypes(Model)[idx] isa TypeVar || continue - field, Tf = fieldnames(Model)[idx], fieldtypes(Model)[idx].name + T = coretype(Model) + for idx = 1:length(fieldnames(T)) + fieldtypes(T)[idx] isa TypeVar || continue + field, Tf = fieldnames(T)[idx], fieldtypes(T)[idx].name # TODO: Test where vector is not <: DenseArray if Tf == :FT