racket / typed-racket

Typed Racket
Other
527 stars 104 forks source link

message-box needs type in typed/racket/gui from typed/gui #211

Open earldean opened 9 years ago

earldean commented 9 years ago

message-box does not have a type in typed/racket/gui

samth commented 9 years ago

Also message-box/custom.

takikawa commented 9 years ago

I think the reason I didn't add a type for this may have been that the mixin argument was hard to type. If that's the case, I may just specify Bottom for that argument and see if it works.

samth commented 9 years ago

The relevant code uses the :#mixin argument, sadly.

takikawa commented 9 years ago

Also, message-box does have a type AFAICT.

> message-box
- : (->* (String String)
         ((U False (Instance Frame%) (Instance Dialog%))
          (Listof (U 'caution 'stop 'ok 'ok-cancel 'yes-no 'no-icon))
          #:dialog-mixin
          Nothing)
         (U 'ok 'cancel 'yes 'no))
earldean commented 9 years ago

Yes, I was having trouble typing the mixin that it uses.

takikawa commented 9 years ago

I was able to add the types for these mixin arguments after some TR fixes, but unfortunately actually applying it to a mixin doesn't work right now (I think there is either some subtyping or inference case missing). Also the type prints horribly long. So it'll be a while longer before this is supportable.

earldean commented 9 years ago

These types for message-box\custom and message+check-box\custom typed-checked successfully.

[message-box/custom (->* [String String (U String (Instance Bitmap%) False) (U String (Instance Bitmap%) False) (U String (Instance Bitmap%) False)] [(U (Instance Frame%) (Instance Dialog%) False) (Listof (U 'stop 'caution 'no-icon 'number-order 'disallow-close 'no-default 'default=1 'default=2 'default=3)) (U Any False)

:dialog-mixin (Frame% . -> . Frame%)](U 1 2 3))]

[message+check-box/custom (->* [String String String (U String (Instance Bitmap%) False) (U String (Instance Bitmap%) False) (U String (Instance Bitmap%) False)] [(U (Instance Frame%) (Instance Dialog%) False) (Listof (U 'stop 'caution 'no-icon 'number-order 'disallow-close 'no-default 'default=1 'default=2 'default=3)) (U Any False)

:dialog-mixin (Frame% . -> . Frame%)](Values %28U 1 2 3%29 Boolean))]