---
# System prepended metadata

title: More Strict Type Checking for Fields
tags: [functional cycle 13]

---

# More Strict Type Checking for Fields

###### tags: `functional cycle 13`

Developers: 
Appetite: 

## Background

The current type checking for field types is not very strict. It is for example possible to construct fields without a dense type, e.g. `Field[[CEDim], float]` or Fields with incompatiple sparse and dense types `Field[[VertexDim, C2EDim], float]`. Stencils exhibiting these kind of defects silently compile down to `gtfn`, and may only fail during compilaton of the c++ stage, or potentially even compile and run. This leads to either bad user experience with hard to understand errors or, in the worst case, hard to trace bugs.

## Known Steps

* This type checking should be performed in `icon4py`, since it's rather model specific. Also, its consistent with the corrent code base, since all the dimensions are defined in `common/src/icon4py/common/dimension.py`
* There are different ways to do this, the obvious one being a visitor that collects all fields and does the checks described above. There may be other ways to achieve this (python meta classes?). Alternatives should be explored with an experienced python engineer

## Non-Goals

This project is not related to dusk-style location chains. Do not try to introduce them in this project.

