这是indexloc提供的服务,不要输入任何密码
Skip to content

Update unit-from-context typechecking strategy #1306

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 2 commits into from
Feb 7, 2023

Conversation

lexi-lambda
Copy link
Member

This PR updates the way Typed Racket typechecks unit-from-context forms to support racket/racket#4567. It should not be merged until that PR is merged, so I’ve marked it a draft for now.

(This branch also includes PR #1303, since it is necessary for it to work. If this PR is merged before that one is, then #1303 can be closed.)

This structure is not used for anything, and being picky about it causes
some unnecessary breakage with the changes I’ve been working on for
racket/racket#4550.
@shhyou
Copy link
Contributor

shhyou commented Feb 6, 2023

Given the dependency between two PRs, should there be a version bump?

@lexi-lambda lexi-lambda force-pushed the new-unit-from-context branch from 5d79b11 to e200f79 Compare February 7, 2023 01:38
@lexi-lambda
Copy link
Member Author

Yes, good point—I’ve updated racket/racket#4567 to bump the version number and updated this patch to bump the dependency.

@mflatt mflatt marked this pull request as ready for review February 7, 2023 02:23
@mflatt mflatt merged commit 1abc1b4 into racket:master Feb 7, 2023
@lexi-lambda lexi-lambda deleted the new-unit-from-context branch February 7, 2023 02:28
@shhyou
Copy link
Contributor

shhyou commented Feb 11, 2023

In the test unit-typed-untyped-2.rkt, the subject of the error message changed from y to u, leading to the test failure

unit-typed-untyped-2.rkt > ./fail > Integration tests > Typed Racket Tests > Unnamed test
predicates:   (#rx"u: contract violation\n  expected: exact-integer?")
name:         check-exn
location:     typed-racket-test/main.rkt:105:34
expression:   (check-exn pred thnk)
params:
  '(#<procedure:...acket-test/main.rkt:22:3>
  #<procedure:...acket-test/main.rkt:86:10>)
message:      "Wrong exception raised"
exn-message:
  "y: contract violation\n  expected: exact-integer?\n  given: \"not an integer\"\n  in: the 1st argument of\n      the y member of\n      signature y^ exported by\n      (unit/c\n       (import (x^ (x exact-integer?)))\n       (export (y^ (y g15)))\n       (init-depend)\n       any/c)\n  contract from: \n      (/home/runner/work/typed-racket/typed-racket/typed-racket-test/fail/unit-typed-untyped-2.rkt\n       typed)\n  contract on: u\n  blaming: (/home/runner/work/typed-racket/typed-racket/typed-racket-test/fail/unit-typed-untyped-2.rkt untyped)\n   (assuming the contract is correct)\n  at: <pkgs>/typed-racket-test/fail/unit-typed-untyped-2.rkt:10:10"
exn:
  #(struct:exn:fail:contract "y: contract violation\n  expected: exact-integer?\n  given: \"not an integer\"\n  in: the 1st argument of\n      the y member of\n      signature y^ exported by\n      (unit/c\n       (import (x^ (x exact-integer?)))\n       (export (y^ (y g15)))\n       (init-depend)\n       any/c)\n  contract from: \n      (/home/runner/work/typed-racket/typed-racket/typed-racket-test/fail/unit-typed-untyped-2.rkt\n       typed)\n  contract on: u\n  blaming: (/home/runner/work/typed-racket/typed-racket/typed-racket-test/fail/unit-typed-untyped-2.rkt untyped)\n   (assuming the contract is correct)\n  at: <pkgs>/typed-racket-test/fail/unit-typed-untyped-2.rkt:10:10" #<continuation-mark-set>)
--------------------
1188 success(es) 1 failure(s) 0 error(s) 1189 test(s) run
Typed Racket Tests did not pass.

What's the expected behavior here?

@lexi-lambda
Copy link
Member Author

The new error message is intended. Sorry for not catching that myself, I was only running typed-racket-test/unit-tests/all-tests.rkt, but I really should have run the whole test suite.

samth pushed a commit that referenced this pull request Feb 11, 2023
According to @lexi-lambda, the error message should refer to `y`, not `u`.
See #1306 (comment)
for the relevant changes.
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.

3 participants