Skip to content

Filter nested generic definitions by all generic constraints#78

Merged
VPDPersonal merged 1 commit into
feature/serialize-reference-dropdownfrom
fix/typeselector-multi-constraint-nested-generics
Jun 23, 2026
Merged

Filter nested generic definitions by all generic constraints#78
VPDPersonal merged 1 commit into
feature/serialize-reference-dropdownfrom
fix/typeselector-multi-constraint-nested-generics

Conversation

@VPDPersonal

Copy link
Copy Markdown
Owner

Summary

  • Fix BuildParamPage over-broadening the nested open-generic list for a type parameter with multiple base constraints (where T : Base, IFoo).
  • Instead of collapsing the constraints to a single type (or object) before fetching nested definitions, pass the full baseTypes to GetAssignableGenericDefinitions so the candidate defs are narrowed by every constraint up front — no more dead-end picks that end in an inline "Cannot construct…" error.

Notes for review

  • GetAssignableGenericDefinitions(fieldType, params Type[] narrowTypes) checks closeability against fieldType and each narrowing type; GetConstraintBaseTypes never returns an empty array (it falls back to { typeof(object) }), so baseTypes[0] is safe and object entries are ignored by the narrowing filter.
  • constraintType is left untouched — it still backs the PickerPage.ConstraintType used downstream.

Linked issues

Refs #49 - addresses review finding #49 (comment)

@VPDPersonal VPDPersonal added type: fix Bug fix status: needs-review Ready for review area: editor Editor-only code labels Jun 21, 2026
@VPDPersonal VPDPersonal merged commit 08aa26a into feature/serialize-reference-dropdown Jun 23, 2026
1 check passed
@VPDPersonal VPDPersonal deleted the fix/typeselector-multi-constraint-nested-generics branch June 23, 2026 13:56
@github-actions github-actions Bot removed the status: needs-review Ready for review label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor-only code type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant