Skip to content

Add conformance tests around type decaying - #530

Open
l46kok wants to merge 2 commits into
cel-expr:masterfrom
l46kok:type-decaying-conformance
Open

Add conformance tests around type decaying#530
l46kok wants to merge 2 commits into
cel-expr:masterfrom
l46kok:type-decaying-conformance

Conversation

@l46kok

@l46kok l46kok commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Note that these will currently fail in all stacks. They require a much more involved fix around joining types

}
}
}
deduced_type {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@jnthntatum I believe this is the desired outcome, let me know what you think

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's debatable whether the value would be list(list(type(int))), only because the empty list should have a free type parameter that gloms into the very specific element type on the right

@l46kok l46kok Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That was pretty much the conundrum I had (list<list<type<int>>> is what go produces today). Here's how I went about thinking about this. I think the LHS addition is not so controversial:

LHS = ([] + [[type(1)]]) -> list<list<type<int>>>

The troublesome part comes next:

[[type([])]] -> list<list<type<list<dyn>>> (Due to type decaying)

(LHS) + [[type([])]] -> concatenating list<list<type<int>>> with list<list<type<list<dyn>>>

So the question becomes, how to compute the least upper bound of the inner elements:

list < list < type<int> ⊔ type<list<dyn>> > >

int and list are disjoint types, so int ⊔ list<dyn> = dyn. Substitute it back to the AST, the resulting type is list<list<type<dyn>>>.

This is also consistent with how the runtime would've evaluated to [ [type(int)], [type(list)] ]

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.

2 participants