Commit Graph

3207 Commits

Author SHA1 Message Date
Asumu Takikawa
fc00888943 Correctly check letrec-values clauses with no vars
Should unbreak the build, my apologies to bisecters

original commit: 36c3861494821c9efb1db9df278c77663e1ddb13
2014-03-12 01:18:16 -04:00
Asumu Takikawa
303f87c5eb Clarify a few comments in TR
These are for letrec typechecking and Tarjan's algorithm

original commit: 04c3851ebc1e7c78d314f833de1c76ab458202ed
2014-03-11 23:48:59 -04:00
Asumu Takikawa
07a8649e4d Use Tarjan's algorithm for typechecking letrecs
This allows us to type-check non-recursive sequences of
letrec-values clauses in the right order. In other words,
we will type-check the clauses in reverse topological
order (the reverse of the dependency order).

Clauses that are recursive go through the usual
type-checking process, injecting Undefined where necessary.

original commit: 93a2798ec3f41e113a282e10c31473d117f590e5
2014-03-11 23:03:39 -04:00
Asumu Takikawa
4f7bc4d5d3 Move TR's Tarjan's algorithm to a separate file
Also generalize so that it can be used in other
parts of the codebase.

original commit: 292a47c3dddbe4a311ad0133e992320d429f56b5
2014-03-11 23:03:39 -04:00
Asumu Takikawa
fbf9614f02 Improve letrec-values type-checking
Split into two passes in order to be able to find
more cases where the RHS doesn't refer to the bindings
in the letrec.

Closes PR 13124

original commit: bdb8833fa501a068f8fcebcf89cbf7c071a6c9c6
2014-03-11 23:03:39 -04:00
Asumu Takikawa
f90c6f92b0 Add type annotations for GUI libraries
The types for racket/gui are substantially complete, but
there are still some missing classes and methods.

Some interesting future work would be to ensure type coverage
by comparing the class members vs. the types in the environment.
That could be run as a test to ensure it stays up to date.

Most types for the framework library are still missing.

original commit: 00a3b7cb149ae35c63b9eb64df34d87424407a10
2014-03-11 17:39:02 -04:00
Asumu Takikawa
72e1cfc91b Make printing of Name types unfold correctly
original commit: 90dccbdffb3f5bf1de50cb1a6473f8492df517ff
2014-03-11 17:39:02 -04:00
Asumu Takikawa
d93ac7e2ff Add static contracts for instanceof
original commit: 4bc4a74d00b62522caaf0fd9a4d334e440d5a56b
2014-03-11 17:39:02 -04:00
Asumu Takikawa
8ff305e328 Add recursive type alias support to TR
This expands the `Name` type functionality to go
beyond struct names and allows arbitrary recursive
type aliases to use the environment for indirection.

In addition, such aliases can be mutually recursive.

original commit: a8cc430d0fc7090dd758e0f6738296edcb4d8490
2014-03-11 17:39:02 -04:00
Eric Dobson
f6f23ef043 Make TR tests work with contracts enabled.
original commit: edc8bbf6b4601bdf083b1889a11b86bd64488d6d
2014-03-10 21:09:36 -07:00
Asumu Takikawa
951c64f94d Fix TR tests for new error messages
Related to commit fa81fb35f7361f0a985ad4d311400d621a2a5496

original commit: b205c99560d21b80d975dda3fa5f688ae832cd0f
2014-03-10 17:02:31 -04:00
Asumu Takikawa
41291066b4 Update several application type error messages
original commit: fa81fb35f7361f0a985ad4d311400d621a2a5496
2014-03-10 14:59:42 -04:00
Eric Dobson
825fb1c2e4 Changes printer to be more consistent.
Also make printer tests part of the unit tests.

original commit: e34a2484512b94d7f829a013694caf46e360420c
2014-03-06 09:54:06 -08:00
Eric Dobson
f2e2a4b7f9 Add tests for check-below.
original commit: d2c415f5979caf4d93248ee0a9b6a6a2b7ee4736
2014-03-06 09:44:09 -08:00
Asumu Takikawa
64515f386a TR: better error for invalid super-make-object
original commit: 994648c556e026df55d95bddf017b9a5ce723688
2014-03-05 01:45:39 -05:00
Asumu Takikawa
f25af5b48a Improve TR's check for by-name superclass inits
Make sure to check that by-name inits are actually accepted
by the superclass and produce a good error when they aren't.

original commit: b0ba3272cb7dadba24b0bcba73128bef3f312d06
2014-03-05 01:45:39 -05:00
Asumu Takikawa
f27449fc44 TR: fix error case when superclass is not a class
original commit: a0ce1fa02cb8cdd55b6c7bea9d641ca48e3bd6e6
2014-03-05 01:45:39 -05:00
Asumu Takikawa
400b6d438c Rewrite TR pass for class top-level expressions
Instead of making separate passes over the expressions,
make a single pass to collect necessary information for
type-checking.

This enables simpler processing of type annotations,
super initialization arguments, and other things.

original commit: 0bacba7a68321ff08187d0a5d95b02b8351cdd3f
2014-03-05 01:10:44 -05:00
Asumu Takikawa
805cc5e686 Synthesize types for private fields in classes
Allows type annotations to be left out in some cases

original commit: 9c63978a582c2b26be3121cbfd3759de81b7f97f
2014-03-04 16:37:56 -05:00
Asumu Takikawa
5aa1c61c04 One more "undefined identifier" change in TR
For the top-level undefined/missing annotation case

original commit: 2ed669242847587a33f053e717ec2f6a6cf5ba4c
2014-03-04 14:20:16 -05:00
Asumu Takikawa
00c08e48be Change TR's "untyped identifier" error messages
original commit: d62eedaa47b66dc2a804539c3c78b9f313a9243f
2014-03-04 13:51:31 -05:00
Asumu Takikawa
0a77337179 Let TR typecheck more un-annotated definitions
This commit allows definitions without type annotations
to refer to definitions later in a module that do have
type annotations. For example,

  (define (f x) (g 0))
  (: g (-> Integer Integer))
  (define (g x) (add1 x))

Previously, such cases required shuffling type annotations
and/or definitions around to satisfy the type-checker.

Note that typechecking may still depend on ordering when
there are not enough type annotations in the code.

Closes PR 11544

original commit: 343ac526073ab8c2520399316e5391452f3f7dc0
2014-03-04 13:51:31 -05:00
Asumu Takikawa
bc9086e156 Allow flvectors/fxvectors in Any contract
Closes PR 14374

original commit: 5c7046cab32bbe9b54981d13fe5c6ba1ebcd43f0
2014-03-03 13:50:51 -05:00
Asumu Takikawa
9efd61102d Add more tests for PR 14380
Related to 07bde5063b5a3a83f61e85f00a1c6ce6e0a097d2

original commit: d2a3849c6ff39e3c68ce0d1e7fc531352c0086e9
2014-03-01 13:42:34 -05:00
Asumu Takikawa
6ade61f913 One more #:literal-sets
Missed this in 07bde5063b5a3a83f61e85f00a1c6ce6e0a097d2

original commit: 4a078e36d90e2f9ba2a7696c75dd08e47fa52ce2
2014-03-01 13:42:34 -05:00
Eric Dobson
2dd75d1089 Use abbreviations and default values for filters more in unit tests.
original commit: be7c4fb5c0973fa5fa85de8a4fa6c8f723cdc2ed
2014-02-28 19:35:41 -08:00
Eric Dobson
4b876e7221 Add -no-obj and -no-filter abbreviations.
original commit: fe8500437bc854769083feb76bea33f38297694e
2014-02-28 19:34:48 -08:00
Eric Dobson
cf9a3d5008 Rename -no-obj and -no-filter to -empty-obj and -top-filter.
original commit: d401a398cd9317cc0265493e9ed9eb785cd4f5a8
2014-02-28 19:34:47 -08:00
Asumu Takikawa
26746ac8b5 Add #:literal-sets for several TR optimizer cases
The matching was too inclusive in some cases, causing
spurious optimizations (or type-table lookup failures).

Closes PR 14380

original commit: 07bde5063b5a3a83f61e85f00a1c6ce6e0a097d2
2014-02-28 20:57:05 -05:00
Asumu Takikawa
47080bc073 Add make-input-port, make-output-port to TR
original commit: 32cd4d297316b76d9eb7b2e9608618552e8a2a6b
2014-02-28 16:16:01 -05:00
Asumu Takikawa
448e538142 Add install info to TR optimization guide section
original commit: 3effaed55fd1415de5b3b1c30585d8748c805384
2014-02-28 14:30:16 -05:00
Vincent St-Amour
e2b4c39241 More docs about contract costs in TR.
original commit: 1fa0bb0e033e6ed8172045ccb34f1df697636fec
2014-02-28 11:36:51 -05:00
Asumu Takikawa
133a961596 Fix a TR bug for row polymorphic application
The domains in a row polymorphic function weren't checked
properly when row inference was used.

original commit: 32f09c35705206a281fcd1f02b968c7ad02ece69
2014-02-27 18:41:05 -05:00
Matthew Flatt
3bda5906bf LGPL by reference
original commit: 981701d2378179d4ada54b7fd2608df3b89748fd
2014-02-27 15:56:11 -07:00
Asumu Takikawa
f579129af8 Adjust handling of types for non-expressions
Some forms like `define` do not produce a value
and thus do not have a type. Instead of returning
the #<void> value for these cases, return the symbol
'no-type.

Also fix printing in several places to reflect this.

Fixes a regression due to commit 00470e3 and also
fixes an unreported bug with (:print-type ...) on
non-expressions.

Closes PR 13758

original commit: 1747b700976a664ec7ee5a9004e02a173910a2e2
2014-02-27 17:17:54 -05:00
Eric Dobson
7cd4da639f Fix type of - to not be wrong on negative fixnums
Rolling this forward because the math library is no longer dependent on
the broken behavior. Also nothing in the main repo seems to depend on
this.

original commit: 0a81627eca8233edca95368938c739a9d268407f
2014-02-26 22:06:53 -08:00
Asumu Takikawa
a97fe80bbd Catch syntax lifting at the top-level in TR
This is helpful for typechecking forms that lift
expressions such as object instantiation or contracted
values when they are used at the top-level.

It's not normally an issue for typechecking modules
because lifting is delimited by the module extent so that
normal local-expansion will cover it.

original commit: 00470e3e1a09f88a32c6b20682b577669655a2c4
2014-02-26 23:10:26 -05:00
Asumu Takikawa
08fa6df119 Make row inference slightly smarter
Now it works as long as one of the arguments is, in
all cases, a row polymorphic class type

original commit: 30c49028cb124bf252d518b60bb4db94a48943c4
2014-02-26 17:39:13 -05:00
Eric Dobson
5cbc1369d4 Revert "Fix type of - to not be wrong on negative fixnums."
The math library is relying on the current broken behavior. Revert until
we can fix it.

original commit: 62a09958d2d8eca8d44ade23e83a9ecdc4777ecc
2014-02-26 00:34:40 -08:00
Eric Dobson
b227a5e50c Fix type of - to not be wrong on negative fixnums.
original commit: faab297ab9a74d167a23e84756737208bd5c8b02
2014-02-25 09:54:28 -08:00
Eric Dobson
e3bb9c3e0e Add missed optimization tests for add1/sub1.
original commit: 40e3c50db7d5873592bc109dc0a0771e473d2107
2014-02-25 00:30:52 -08:00
Eric Dobson
37f274004a Revert split of float-ops because the remaining ones never trigger.
flreal-part only is valid on float-complex numbers and the code in
float-complex.rkt already covers it.

original commit: 5f636af86ad3cb7a4bb462c90c099ba3b662438f
2014-02-24 22:40:36 -08:00
Asumu Takikawa
9ba5f398cf Add TR rep-tests to the main unit tests file
Forgot to make this change in commit
7907320733b6d29b2382e016c10888acbf4e1c67

original commit: ac6ec3b43b9e2c838235f48a08ce8c15586294d3
2014-02-25 01:34:43 -05:00
Asumu Takikawa
36fbea7669 Remove some debugging code in subtype checker
original commit: 2d46d430b79d92af3d5c00b001860c1844f96892
2014-02-25 01:22:42 -05:00
Asumu Takikawa
2665e2b916 Use the correct index for unsafe-Type-key
The unsafe operation didn't return the same result as
the safe operation, meaning any checks related to type keys
were giving the wrong result. As a result, some subtyping
clauses were not triggered.

original commit: 7907320733b6d29b2382e016c10888acbf4e1c67
2014-02-25 01:22:42 -05:00
Asumu Takikawa
2dd8725cbd Fix infinite loop in List: expander in subtyping
The match expander calls `resolve` during subtyping, which
is a problem for types that recur through the environment like
Struct types because it doesn't coordinate with the cache
for subtyping.

Closes PR 14364

original commit: 7585581f00a40f59d5f29159622a10640cfbdec9
2014-02-24 18:07:02 -05:00
Asumu Takikawa
c26f9b4c73 Support ValuesDots in a typechecking a funapp
Closes PR 13651

original commit: 4f3c98f7549bc0fe2641dea92bd1188bb527bfdf
2014-02-24 10:54:31 -05:00
Eric Dobson
a8e01d8707 Add more optimizations for projections.
original commit: 262fad814afc33dbac8e927409dca225faf00686
2014-02-23 23:45:28 -08:00
Eric Dobson
758a055b0b Change float optimizations to not warn on projections.
original commit: b89a56e0ec4e561ae70b823be3140b860be3d34c
2014-02-23 23:45:27 -08:00
Eric Dobson
8b6c27cf1d Refine type for angle
original commit: 4ca07b3ac8cf1a9839de8330c2324fff4b0344fc
2014-02-23 23:45:26 -08:00