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

feat: improvements to constraints #896

Merged
merged 15 commits into from
Feb 19, 2024
Merged

feat: improvements to constraints #896

merged 15 commits into from
Feb 19, 2024

Conversation

lars-reimann
Copy link
Member

@lars-reimann lars-reimann commented Feb 19, 2024

Closes partially #18

Summary of Changes

  • Remove lower type parameter bounds. We don't have a use case for them and they vastly complicated the implementation. For instance, Nothing is no subtype of a type parameter type with a lower bound other than Nothing. This means, when computing the highest common subtype (Handle type parameters when computing lowest common supertype #860), we could only return $unknown for a type parameter type with a lower bound of, say, Int, and another type like Number.
  • Specify the upper bound of a type parameter directly where it's declared. Since they cannot also have a lower bound anymore and previously could only have a single, acyclic upper bound, we don't lose additional expressiveness this way. Previous type parameters may be used as the upper bound of later ones. The scope provider prevents forward references.
  • Add syntax, formatting and scoping for parameter bounds (Parameter bounds #18). We are doing this in this PR, since we would otherwise not have constraints to test constraint lists with.

Copy link

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ JSON eslint-plugin-jsonc 1 0 0 1.04s
✅ JSON jsonlint 1 0 0.23s
✅ JSON npm-package-json-lint yes no 0.73s
✅ JSON prettier 1 0 0 0.98s
✅ JSON v8r 1 0 1.95s
✅ PYTHON black 1 0 0 0.75s
✅ PYTHON mypy 1 0 2.28s
✅ PYTHON ruff 1 0 0 0.15s
✅ REPOSITORY git_diff yes no 0.14s
✅ TYPESCRIPT eslint 12 0 0 6.61s
✅ TYPESCRIPT prettier 12 0 0 1.72s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7e0dc3f) 100.00% compared to head (eea3c31) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #896    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           93        92     -1     
  Lines        16792     16517   -275     
  Branches      3423      3350    -73     
==========================================
- Hits         16792     16517   -275     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lars-reimann lars-reimann marked this pull request as ready for review February 19, 2024 19:18
@lars-reimann lars-reimann merged commit b81bef9 into main Feb 19, 2024
12 checks passed
@lars-reimann lars-reimann deleted the no-lower-bound branch February 19, 2024 19:19
lars-reimann pushed a commit that referenced this pull request Feb 26, 2024
## [0.8.0](v0.7.0...v0.8.0) (2024-02-26)

### Features

* check the runner version to be compatible ([#888](#888)) ([83378a3](83378a3)), closes [#880](#880)
* check type parameter bounds for default values and named types ([#919](#919)) ([7003ea6](7003ea6)), closes [#614](#614)
* clamp default values of parameter types to upper bound ([#921](#921)) ([76ad869](76ad869))
* compute highest common subtype ([#901](#901)) ([5630a9f](5630a9f)), closes [#860](#860)
* compute type parameters for calls ([#920](#920)) ([35dc826](35dc826)), closes [#861](#861)
* consider nullability of upper type parameter bound in various checks ([#892](#892)) ([940515a](940515a))
* constraints for segments ([#911](#911)) ([e57f886](e57f886)), closes [#903](#903)
* EDA on pipeline Tables ([#834](#834)) ([f42c9aa](f42c9aa))
* error if parent type is nullable ([#891](#891)) ([add650d](add650d))
* escape characters in string conversion of string constants ([#908](#908)) ([72a9c3c](72a9c3c)), closes [#904](#904)
* format upper bound of type parameters ([#898](#898)) ([9d6ce28](9d6ce28))
* handle invariant/covariant type parameters when computing lowest common supertype ([#868](#868)) ([4d6cb4e](4d6cb4e)), closes [#860](#860) [#861](#861)
* improve handling of subclasses of lists/maps ([#890](#890)) ([bb0c94b](bb0c94b))
* improvements to constraints ([#896](#896)) ([b81bef9](b81bef9)), closes [#18](#18) [#860](#860) [#18](#18)
* include enum name in string conversion of enum variant types ([#907](#907)) ([1f6502e](1f6502e)), closes [#902](#902)
* scoping for member accesses if receiver has type parameter type ([#889](#889)) ([1277bd1](1277bd1))
* shorter message if runner is started but files have errors ([#912](#912)) ([b611b44](b611b44)), closes [#910](#910)
* simplify union types containing type parameter types disregarding entry order ([#894](#894)) ([cf6e77e](cf6e77e))
* singular type is its own lowest common supertype ([#893](#893)) ([79d611d](79d611d))
* substitute type parameter when type checking calls ([#923](#923)) ([2e09306](2e09306)), closes [#915](#915)
* substitute type parameters when checking overridden members ([#922](#922)) ([0e657cf](0e657cf)), closes [#917](#917)
* update to `safe-ds-runner` v0.7.0 ([#906](#906)) ([070f406](070f406))
* use bounds of type system where possible ([#899](#899)) ([cf92762](cf92762))

### Bug Fixes

* lenient type checking involving type parameter types ([#916](#916)) ([b9d3641](b9d3641)), closes [#915](#915) [#915](#915)
* runner startup silent failure ([#914](#914)) ([8812944](8812944)), closes [#909](#909)
* save dirty files before running pipeline ([#918](#918)) ([4302ca6](4302ca6))
* simplification of union types ([#897](#897)) ([4c577a3](4c577a3))
@lars-reimann
Copy link
Member Author

🎉 This PR is included in version 0.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant