Skip to content

Fix valueformalarg literals not having a type#162

Merged
IgorDeepakM merged 7 commits intomasterfrom
fix_valueformal_not_processed
Apr 28, 2026
Merged

Fix valueformalarg literals not having a type#162
IgorDeepakM merged 7 commits intomasterfrom
fix_valueformal_not_processed

Conversation

@IgorDeepakM
Copy link
Copy Markdown
Owner

There are cases when the literals of a TK_VALUEFORMALARG in typeargs in a nominal type are not typed. This is because the types of method later on might be used and copied despite the nominal types haven't been processed in the expression pass yet.

In order to fix this, reify adds an attempt to type and coerce the type value literals. Fixes in the subtype check, now checks the param type instead of the ast_type of the literal in case it hasn't been set yet. In method_call, the return type is run through ast_passes_subtree in order for it to be processed because the type of TK_CALL is being used for several purposes like infer type.

Added \allowstruct\ to bypass not allowing structs as type parameters. This annotations can be used together with a type constraint which isn't the case with AnyNoCheck which is a constraint in itself and cannot be used with additional type constaints.

There are cases when the literals of a TK_VALUEFORMALARG in
typeargs in a nominal type are not typed. This is because the
types of method later on might be used and copied despite the
nominal types haven't been processed in the expression pass yet.

In order to fix this, reify adds an attempt to type and coerce
the type value literals. Fixes in the subtype check, now checks
the param type instead of the ast_type of the literal in case
it hasn't been set yet. In method_call, the return type is run
through ast_passes_subtree in order for it to be processed because
the type of TK_CALL is being used for several purposes like infer
type.

Added \allowstruct\ to bypass not allowing structs as type
parameters. This annotations can be used together with a type
constraint which isn't the case with AnyNoCheck which is a
constraint in itself and cannot be used with additional type
constaints.
use ast_visit instead of pass_expr
@IgorDeepakM IgorDeepakM merged commit 5638653 into master Apr 28, 2026
1 of 4 checks passed
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.

1 participant