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

Compiler should prevent invalid scopes in query syntax #5

Open
martypitt opened this issue Aug 29, 2023 · 0 comments
Open

Compiler should prevent invalid scopes in query syntax #5

martypitt opened this issue Aug 29, 2023 · 0 comments

Comments

@martypitt
Copy link
Contributor

When we're using scopes to narrow in a query, the compiler should detect invalid scope projections.

Here's some examples:

Types not present in scope

   type Unrelated inherits String
         model Film {
               title : FilmTitle inherits String
            }

// This is illegal, as Unrelated is not in scope.
            find { Film[] } as (unrelated:Unrelated) -> {
               title : FilmTitle
            }[]

Types amgibuously referenced in array

            type ActorName inherits String
            model Movie {
                title : MovieTitle inherits String
                actors : ActorName[]
            }
         """.compiledWithQueryProducingCompilationException(
            """
                // This should be illegal, as ActorName is actually present in an Array,
                // (ActorName[])
                // so the projection scope is ambiguous.
                //
            find { Movie } as (actors:ActorName) -> {
               actorNames : ActorName
            }
martypitt added a commit that referenced this issue Aug 29, 2023
…ing invalid things with scopes in a query

Tests to prove #5
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

No branches or pull requests

1 participant