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

TC: Iterate typechecking function arguments #753

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

Alasdair
Copy link
Collaborator

Previously we would do a single pass over all function arguments left-to-right to instantiate the function quantifiers, but this sometimes fails in some cases, e.g.

val operator @ : forall 'n 'm. (bits('n), bits('m)) -> bits('n + 'm)

let x : bits(5) = zeros() @ 0b1

where we can instantiate the quantifiers by:

  • First using the second argument to find 'm

  • Using the return type bits(5) to calculate 'n

  • Then checking the first argument

To solve this, we can defer any arguments where we failed to infer the type or got a unification error, then check them again. If we fail to make progress then stop.

…be instantiated

Previously we would do a single pass over all function arguments left-to-right to
instantiate the function quantifiers, but this sometimes fails in some cases, e.g.

val operator @ : forall 'n 'm. (bits('n), bits('m)) -> bits('n + 'm)

let x : bits(5) = zeros() @ 0b1

where we can instantiate the quantifiers by:

- First using the second argument to find 'm

- Using the return type bits(5) to calculate 'n

- Then checking the first argument

To solve this, we can defer any arguments where we failed to infer
the type or got a unification error, then check them again. If we fail
to make progress then stop.
Copy link

github-actions bot commented Oct 30, 2024

Test Results

   10 files  ±0     22 suites  ±0   0s ⏱️ ±0s
  704 tests +1    704 ✅ +1  0 💤 ±0  0 ❌ ±0 
2 196 runs  +3  2 195 ✅ +3  1 💤 ±0  0 ❌ ±0 

Results for commit 4e6b071. ± Comparison against base commit 9e228eb.

♻️ This comment has been updated with latest results.

@Alasdair Alasdair merged commit 2183aa3 into sail2 Oct 30, 2024
10 checks passed
@Alasdair Alasdair deleted the bvimplictconcat branch October 30, 2024 18:07
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.

1 participant