samth / test-bugs

2 stars 0 forks source link

struct accessor infers wrong type #158

Open samth opened 12 years ago

samth commented 12 years ago
Originally submitted on: Wed Mar 14 08:28:01 -0400 2012

This program fails to typecheck without the annotation. It claims that the domain of (Cvt-cvt cvt) is Nothing', instead ofT0'.

#lang typed/racket/base

(struct: (T0 T1) Cvt ([cvt : (T0 -> T1)]))

(: cvt-apply (All (T0 T1) (T0 (Cvt T0 T1) -> T1)))
(define (cvt-apply value cvt)
  ((ann (Cvt-cvt cvt) (T0 -> T1)) value))

(: ItoS-Convert (Cvt Integer String))
(define ItoS-Convert
  (Cvt (λ: ((x : Integer)) "Hello")))

(: ItoS (Integer -> String))
(define (ItoS int)
  (cvt-apply int ItoS-Convert))
Release:
5.2.1.6--2012-02-25(9ac77a0/g)
Environment:
unix "Linux ajax 3.0.0-16-generic-pae #28-Ubuntu SMP Fri Jan 27 19:24:01 UTC 2012 i686
 i686 i386 GNU/Linux" (i386-linux/3m) (get-display-depth) = 32
Human Language: english
(current-memory-use) 275888408
Links: (links) = ("assignments" "book" "var" "class"); (links #:user? #f) = (); (links
 #:root? #t) = (); (links #:user? #f #:root? #t) = ()

Collections:
("/home/samth/sw/plt/add-on/5.2.1.6/collects"
 ("info-domain"))
("/home/samth/sw/plt/collects"
 ("ffi" "hierlist" "images" "teachpack" "repo-time-stamp" "tool" "icons" "framework"
 "raco" "planet" "test-engine" "trace" "unstable" "htdp" "racunit" "setup" "embedded-gui"
 "readline" "0001-Ensure-that-vector-index-is-an-integer.patch" "browser" "xrepl"
 "deinprogramm" "raclog" "algol60" "make" "scribblings" "mzscheme" "mrlib" "sgl" "r5rs"
 "xml" "redex" "repos-time-stamp" "honu" "games" "syntax-color" "launcher" "parser-tools"
 "reader" "slideshow" "help" "drscheme" "scheme" "dynext" "rackunit" "afm" "srpersist"
 "typed-racket" "rico" "sirmail" "tests" ".gitignore" "handin-client" "plot" "html"
 "tex2page" "handin-server" "meta" "info-domain" "data" "graphics" "profile" "lazy" "db"
 "macro-debugger" "lang" "compiler" "mzcom" "gui-debugger" "guibuilder" "mysterx"
 "datalog" "frtime" "rnrs" "scribble" "r6rs" "stepper" "syntax" "scriblib" "2htdp"
 "combinator-parser" "schelog"
 "0001-Make-autocompletion-fuzzier-similar-to-the-doc-searc.patch" "string-constants"
 "waterworld" "openssl" !
 "schemeunit" "slatex" "errortrace" "plai" "net" "eopl" "s-exp" "drracket"
 "picturing-programs" "mzlib" "typed-scheme" "wxme" "racklog" "web-server" "config"
 "test-box-recovery" "srfi" "mred" "version" "defaults" "at-exp" "texpict" "file"
 "swindle" "typed" "preprocessor" "racket" "mz"))

Computer Language: (("Determine language from source") (#(#t print mixed-fraction-e #f #t
 none) (default) #() "#lang racket\n" #f #f))
This bug was converted from Gnats bug 12631.