-
-
Notifications
You must be signed in to change notification settings - Fork 103
fix issue #169 #170
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
fix issue #169 #170
Conversation
@@ -266,7 +266,7 @@ | |||
;; [(_ (Univ:)) A0] | |||
;; error is top and bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, does this mean this comment here is no longer true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I think it means that it is only top now. I'm not sure why it would be bot in the first place, but changing this seems to break more tests, so I'm not sure how this should work.
This is not the right change. |
Ok. I just hadn't expected the subtype check here (https://github.com/AlexKnauth/typed-racket/blob/fix/typed-racket-lib/typed-racket/infer/infer-unit.rkt#L483) to succeed, and that was what caused #169 . I'll look for another way to solve this then. |
@samth Is the
Could that be what's causing |
Re: |
Nope. I was wrong. |
The printing issue is almost certainly because we end up with Do you know why |
No I don't. |
I think that's the first thing to investigate. |
It seems like the Error type (still printed as Pos) is in the mapping table before I even call |
Oh. It gets filled with all error types, and then replaced with the correct types later. |
a1190e1
to
50a7294
Compare
Ok I took a completely different approach and it's working now. |
@@ -0,0 +1,10 @@ | |||
#; | |||
(exn-pred #rx"expected: (Listof Nothing).*given: (Listof Pos*)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, except the parens and *
probably aren't good in the regexp there.
How does this look now? |
@@ -17,7 +17,7 @@ | |||
(define-other-types | |||
-> ->* case-> U Rec All Opaque Vector | |||
Parameterof List List* Class Object Values Instance Refinement | |||
pred Struct Struct-Type Prefab Top Bot) | |||
pred Struct Struct-Type Prefab Top Bot Distinction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this now exposed to users? What does it correspond to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not; that's what this except-in is for: https://github.com/racket/typed-racket/pull/170/files#diff-be2db6e0db44e2e94aa8b096cd9b3850R21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I think I understand. Why not create a new internal form, instead of a new type constructor that isn't exposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't think of any other way to allow both new-subtypes to refer to type aliases and for other forms to refer to new-subtypes properly.
But actually, this still is broken, in this example:
#lang typed/racket/base
(define-new-subtype Lst (make-Lst (U Null (Pairof Elt Lst))))
(define-new-subtype Elt (make-Elt (U Symbol Lst)))
(: cns : Elt Lst -> (Pairof Elt Lst))
(define cns
(inst cons Elt Lst))
(: lst : Elt * -> Lst)
(define (lst . args)
(for/fold ([lst (make-Lst '())]) ([elt (in-list (reverse args))])
(make-Lst (cns elt lst))))
With this error highlighting the lst
in the for/fold
accumulator:
. Type Checker: type mismatch
expected: Lst
given: Lst in: lst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'm confused why the work done by this define-type-alias
form can't be done manually in define-new-subtype/pass1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am not sure that we even want to support recursive uses of new-subtype
like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it might be because I never allowed Distinction types to be subtypes of themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, still broken, even with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably @takikawa is the right person to help with recursive aliases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I just fixed it. There was a missing call to resolve in there, and that fixed it. I also added a version of that example as another test.
6104fe0
to
47266cf
Compare
The travis build is passing now, thanks to #175 |
fixes #169