-
Notifications
You must be signed in to change notification settings - Fork 236
Type Inference should be able to resolve a TVTA to a StructOrProcDef #4338
Description
Describe the bug
Currently, in PopulateTableVisitor::HandleStructInstanceInternal, we call GetStructOrProcRef and error out if the type annotation is anything other than a TypeRefTypeAnnotation. It should be possible to use a TypeVariableTypeAnnotation that eventually resolves to a struct or proc def in these cases. PR 4304 introduces a workaround for the case of struct types referenced in lambdas where the TRTA is included as the definer for the TVTA to allow retrieval while populating the table. This workaround is not ideal for a couple reasons:
- This usage of the definer is unintuitive message passing from one piece of code to another.
- It can't be round tripped or replicated by a user writing the longhand form of the lambda.
To Reproduce
Not currently reproducible due since struct instances can't be instantiated as generic types and returns a parser error (see second bullet point above), but supporting generic type struct instantiation will likely require a solution to this issue as well.