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

Review/refactor .in/.inner.in/declaredIn #1179

Open
ssalbdivad opened this issue Oct 16, 2024 · 0 comments
Open

Review/refactor .in/.inner.in/declaredIn #1179

ssalbdivad opened this issue Oct 16, 2024 · 0 comments
Assignees
Labels

Comments

@ssalbdivad
Copy link
Member

The way we represent and deeply extract the input/outputs of a type including morphs has changed over time, and there have been some bugs recently where the wrong variant is used (e.g. ).

In the case of #1170, the following root cause in morph.ts is a good example of why this kind of review is necessary:

			...defineRightwardIntersections("morph", (l, r, ctx) => {
				const inTersection =
                // this innocuous looking `l.in` also extracts nested morphs,
                // removing them from the intersected type.
                // this was fixed by changing l.in to l.inner.in here
					l.inner.in ? intersectOrPipeNodes(l.in, r, ctx) : r
				return inTersection instanceof Disjoint ? inTersection : (
						ctx.$.node("morph", {
							...l.inner,
							in: inTersection
						})
					)

declareIn/declareOut have added some ambiguity to how various intersections should be handled. Their benefit is obvious, but those details need to be hammered out and defined clearly, potentially with some internal renaming so it is clear which variant should be used in any given case. Those have also already led to at least one bug.

Also as part of this, morphs should be converted to a single array with no .in property so it can be handled consistently when extracting input/output.

@ssalbdivad ssalbdivad self-assigned this Oct 16, 2024
@ssalbdivad ssalbdivad changed the title Review .in/.inner.in/declaredIn usage Review/refactor .in/.inner.in/declaredIn Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

1 participant