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

Fix anyscalar behavior in query builder #1089

Open
scotttrinh opened this issue Aug 29, 2024 · 1 comment
Open

Fix anyscalar behavior in query builder #1089

scotttrinh opened this issue Aug 29, 2024 · 1 comment
Labels

Comments

@scotttrinh
Copy link
Collaborator

In EdgeQL, anyscalar is a kind of generic that binds other usages to the same concrete type when applied rather than being a union of all scalar types as the name implies (and as we're currently treating it).

So, when we have a function or operator that uses anyscalar for two or more operands/arguments, the actual type is constrained as if all arguments agree on the instance of the generic. So more like:

function eq<T extends scalar>(l: T, r: T);

instead of

function eq(l: scalar, r: scalar);
// or
function eq<T extends scalar, U extends scalar>(l: T, r: U);
@scotttrinh scotttrinh added the bug label Aug 29, 2024
@naaa760
Copy link

naaa760 commented Sep 23, 2024

@scotttrinh :)

Hello , Please use a constraint such as {function eq<T extends scalar>(l: T, r: T);} to alter function signatures in order to enforce that all arguments share the same concrete type and so fix the anyscalar problem. In order to guarantee type consistency, remove any signatures that permit distinct types. To ensure that the desired behavior is followed and to avoid runtime problems, implement unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants