Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoder: Collect targets w/ interpolation for Any correctly #257

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Apr 13, 2023

As discovered in #251

In a hypothetical perfect/ideal scenario we could collect just targets which match the type but in reality we cannot always establish the expression type, because:

  • we don't recognise all expression types (yet)
  • we'd have to re-implement DAG in some way to ensure we collect and interpolate in the right order
  • not all variables may be known at editing time (some may be provided only at runtime)

Also it's questionable whether it's beneficial to suppress mismatching targets.
We mostly only do it as a hack to aid LiteralType and Reference in OneOf.

The LOC in the diff may seem high, but 95% of that is a result of copying over all tests for reference target collection from LiteralType & replacing LiteralType{Type} with AnyExpression{OfType} + updating that one test for "mismatching" constraint which becomes a positive test.

UX Before

Screenshot 2023-04-13 at 15 33 27

UX After

Screenshot 2023-04-13 at 20 58 09

@radeksimko radeksimko added the bug Something isn't working label Apr 13, 2023
@radeksimko radeksimko self-assigned this Apr 13, 2023
@radeksimko radeksimko changed the title decoder: Collect all complex targets for Any decoder: Collect all complex targets for Any correctly Apr 13, 2023
@radeksimko radeksimko changed the title decoder: Collect all complex targets for Any correctly decoder: Collect targets w/ interpolation for Any correctly Apr 13, 2023
In a perfect/ideal scenario we could collect just targets which match the type
but in reality we cannot always establish the expression type, because:
 - we don't recognise all expression types (yet)
 - we'd have to re-implement DAG in some way to ensure we collect and interpolate in the right order
 - not all variables may be known at editing time (some may be provided only at runtime)

Also it's questionable whether it's beneficial to suppress mismatching targets.
We _mostly_ only do it as a hack to aid LiteralType and Reference in OneOf.
@radeksimko radeksimko force-pushed the b-any-ref-collect-complex-targets branch from 15ab217 to 0fa1525 Compare April 13, 2023 20:18
@radeksimko radeksimko marked this pull request as ready for review April 13, 2023 20:21
@radeksimko radeksimko requested a review from a team as a code owner April 13, 2023 20:21
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dbanck dbanck merged commit f1768be into main Apr 18, 2023
@dbanck dbanck deleted the b-any-ref-collect-complex-targets branch April 18, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants