Skip to content

Conversation

@vkarak
Copy link
Contributor

@vkarak vkarak commented Dec 1, 2022

Reference tuples cannot accept a deferrable as their elements.

This is achieved nicely by extending the type checking system to support composite types and by allowing to insert in the type check subsystem any custom type. For example, one can do the following:

Deferrable = typ.make_meta_type('Deferrable', _DeferredExpression)

# x can be either an integer or a deferrable or a list of integers or floats
x = variable(typ.Integer|Deferrable|typ.List[typ.Integer|typ.Float])

# y can be anything except Deferrable
y = variable(~typ.Deferrable)

This mechanism allows us to remove the other_type argument of TypedField, but it will probably break existing variable definitions of users.

Fixes #2630.

@vkarak vkarak added this to the ReFrame sprint 22.12.1 milestone Dec 1, 2022
@vkarak vkarak requested review from ekouts, teojgo and victorusu December 1, 2022 22:45
@vkarak vkarak self-assigned this Dec 1, 2022
- Reference tuples cannot accept a deferrable.

This is achieved nicely by extending the type checking system to support
composite types and by allowing to insert in the type check subsystem any custom
type. For example, one can do the following:

```python
Deferrable = typ.make_meta_type('Deferrable', _DeferredExpression)

x = variable(typ.Integer|Deferrable|typ.List[typ.Integer|typ.Float])

y = variable(~typ.Deferrable)
```
@vkarak vkarak force-pushed the bugfix/restrict-reference-types branch from 7df66a1 to 519bc9f Compare December 1, 2022 23:05
Copy link
Contributor

@ekouts ekouts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a small comment about imports

Copy link
Contributor

@victorusu victorusu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ekouts
Copy link
Contributor

ekouts commented Dec 14, 2022

@jenkins-cscs retry all

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2022

Codecov Report

Base: 86.59% // Head: 86.59% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (a242771) compared to base (750f7ea).
Patch coverage: 89.74% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2702      +/-   ##
==========================================
- Coverage   86.59%   86.59%   -0.01%     
==========================================
  Files          60       60              
  Lines       11198    11223      +25     
==========================================
+ Hits         9697     9718      +21     
- Misses       1501     1505       +4     
Impacted Files Coverage Δ
reframe/utility/typecheck.py 94.85% <89.18%> (-1.84%) ⬇️
reframe/core/pipeline.py 93.24% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@vkarak vkarak merged commit 7fcfe46 into reframe-hpc:master Dec 15, 2022
@vkarak vkarak deleted the bugfix/restrict-reference-types branch December 15, 2022 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict the types accepted in reference tuples

4 participants