Skip to content

Add Type Checking and Inference Assertions and TypeEnv #109

@am357

Description

@am357

Background

The current tests' data model has the following assertions:

type::{
    name: Assertion,
    type: {
        one_of: [
            SyntaxSuccessAssertion,
            SyntaxFailAssertion,
            StaticAnalysisFailAssertion,
            EvaluationSuccessAssertion,
            EvaluationFailAssertion
        ]
    }
}

In addition, the current model does not support the typing environment to be used for type checking and inference.

On the other side, in partiql-lang-kotlin we have unit tests [1] [2] [3] for type checking and inference. In addition, we also have newer unit-tests [4] as part of PartiQLSchemaInferencer development that assert the correct type checking of PartiQL queries resulting to a StaticType as the output Schema. In addition, in partiql-lang-rust, we are introducing type checking and inference functionality [5] which will require the corresponding tests.

Ask

As PartiQL maintainer I want to have the required partiql-tests assertions for type checking and inference so that I can do the following: (1) write appropriate conformance tests for type checking and inference, and (2) extract the current unit-tests in partiql-lang-kotlin.

DoD

  1. The model for assertions and typing environment is created.
  2. As part of a separate GitHub issue related to this issue, the initial tests are ported from partiql-lang-kotlin are ported to partiql-tests.
  3. As part of a separate GitHub issue related to this issue, the conformance test generators in PartiQL Kotlin and Rust implementations can generate the corresponding tests and make assertions based on them.

[1] https://github.com/partiql/partiql-lang-kotlin/blob/c5809251b24057306aff5e0fb6d433f93011bdd0/partiql-lang/src/test/kotlin/org/partiql/lang/ast/passes/inference/StaticTypeCastTests.kt

[2] https://github.com/partiql/partiql-lang-kotlin/blob/main/partiql-lang/src/test/kotlin/org/partiql/lang/eval/visitors/StaticTypeVisitorTransformTests.kt

[3] https://github.com/partiql/partiql-lang-kotlin/blob/main/partiql-lang/src/test/kotlin/org/partiql/lang/eval/visitors/StaticTypeInferenceVisitorTransformTest.kt

[4] https://github.com/partiql/partiql-lang-kotlin/blob/main/partiql-lang/src/test/kotlin/org/partiql/lang/planner/transforms/PartiQLSchemaInferencerTests.kt

[5] partiql/partiql-lang-rust#399

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions