MeteoSwiss-APN / dawn

Compiler toolchain to enable generation of high-level DSLs for geophysical fluid dynamics models
MIT License
28 stars 30 forks source link

Ensure Location Type Consistency in IfStmt #1076

Closed mroethlin closed 3 years ago

mroethlin commented 3 years ago

Technical Description

So far we failed to ensure location type consistency in between the conditional, then and else branch of of an IfStmt. This allowed code like:

@stencil
def if_condition(hC_x: Field[Cell],
                boundary_edges: Field[Edge]):
    with levels_downward:
        if boundary_edges:
            hC_x = 0

To go through the pipeline, being generated into potentially unsafe code.

Resolves / Enhances

Fixes #1064

Example

See above

Testing

Death- and positive tests added to TestUnstructuredDimensionsChecker with simple as well as nested if statements

Dependencies

This PR is independent.

mroethlin commented 3 years ago

launch jenkins

mroethlin commented 3 years ago

launch jenkins

mroethlin commented 3 years ago

launch jenkins

Stagno commented 3 years ago

launch jenkins