Skip to content

(feat) Type Inference Bounds #73

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

Merged
merged 38 commits into from
Apr 17, 2025
Merged

(feat) Type Inference Bounds #73

merged 38 commits into from
Apr 17, 2025

Conversation

AlSchlo
Copy link
Collaborator

@AlSchlo AlSchlo commented Apr 16, 2025

quick overview

This PR is the next step for type inference in our DSL, and follows #72 .

To solve the constraints, we need two core functions: greatest_lower_bound and least_upper_bound.

  • The least upper bound is the most specific type that is a supertype of both input types.
  • The greatest lower bound is the most general type that is a subtype of both input types.
    See tests for examples.

Furthermore, some code in types.rs was broken, but is now fixed.

  • Map key was not contravariant, but covariant.
  • T was not a subtype of Optional[T].

next steps

Writing the solver is the next and final step for practical type inference. We would still need to handle Generics properly, and propagate Costed/Stored.

@codecov-commenter
Copy link

codecov-commenter commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 98.59571% with 19 lines in your changes missing coverage. Please review.

Project coverage is 80.5%. Comparing base (665f98b) to head (d00d99e).

Files with missing lines Patch % Lines
optd-dsl/src/analyzer/type_infer/glb.rs 97.8% 11 Missing ⚠️
optd-dsl/src/analyzer/type_infer/lub.rs 98.9% 8 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
optd-dsl/src/analyzer/types.rs 96.3% <100.0%> (+0.3%) ⬆️
optd-dsl/src/analyzer/type_infer/lub.rs 98.9% <98.9%> (ø)
optd-dsl/src/analyzer/type_infer/glb.rs 97.8% <97.8%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlSchlo AlSchlo changed the title Alexis/type solver (feat) Type Inference Bounds Apr 16, 2025
@AlSchlo AlSchlo marked this pull request as ready for review April 16, 2025 23:02
@AlSchlo AlSchlo requested review from yliang412, connortsui20 and SarveshOO7 and removed request for yliang412 April 16, 2025 23:02
@AlSchlo AlSchlo merged commit 03bfbcc into main Apr 17, 2025
12 checks passed
@AlSchlo AlSchlo deleted the alexis/type-solver branch April 17, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants