Commit Graph

4543 Commits

Author SHA1 Message Date
Andrew Kent
fea71732d2 fix intersection printing err (#551) 2017-05-20 19:22:05 +01:00
Andrew Kent
076b16bdf0 clean up instantiate/abstract for type vars (#546)
this commit involves no functional changes, just tries
to clean up some of the helper functions in type-rep
related to instantiate/abstract for type vars
2017-05-20 15:58:23 +01:00
Andrew Kent
d6166b0ad3 fix intersection bug (#549)
fix intersection bug

intersections with resolvable types would occasionally generate
spurious weird types (e.g. μx.x) when a type name
is not yet fully defined -- this patches that problem by
using resolve-once instead of resolve and checking the result
for #f before proceeding to compute the intersection
2017-05-20 10:39:10 +01:00
Vincent St-Amour
c0af5235d2 Add support for #:ps argument in command-line. 2017-05-18 15:50:18 -05:00
Georges Dupéron
adb806a7e5 Fix types of udp-related functions 2017-05-18 10:40:53 -05:00
Daniel Feltey
764696752d Disarm syntax in typed unit macros
Closes #536
2017-04-27 17:46:23 -05:00
Daniel Feltey
4b35df2c96 Be less rigid about the shape of type annotations in units
Closes #535
2017-04-27 17:24:54 -05:00
Andrew Kent
80d1654dee add more refinement support for inference and literals (#528)
This PR adds more support for refinement reasoning, in particular
type inference is now aware of argument objects which allows for
more programs w/ refinements to typecheck. Additionally, working
with vector types and literals that are refined or need to have
properties about their length proven now works.
2017-04-22 18:45:22 -04:00
Sam Tobin-Hochstadt
ebb0770edf v6.9 HISTORY 2017-04-21 17:01:52 -04:00
Alex Knauth
2262eb9eaf provide for/flvector, for/extflvector, etc. as aliases for : versions (#534)
Since the type-checker can now handle their expansions.

* add typed/racket/flonum and provide typed for/flvector and for*/flvector from it

* add typed/racket/extflonum and provide typed for/extflvector and for*/extflvector from it
2017-04-21 09:35:29 -07:00
Andrew Kent
f0499ffd11 move refine and linear integer stuff in docs (#533) 2017-04-17 00:27:34 -04:00
Scott Moore
214d597e4b Use code-inspectors to prevent optimization in unsafe contexts. (#531)
The optimizer should only run when the code being compiled could
directly access racket/unsafe/ops. This prevents unsoundness in Typed
Racket from giving untrusted code access to dangerous operations.
2017-04-12 15:17:41 -04:00
WarGrey Gyoudmon Ju
2da40d47b8 fixed two type annotations: Font% and Pen% (#530) 2017-04-11 14:12:29 -04:00
Andrew Kent
5fbf4d30a8 singleton char types if expected type (#527) 2017-03-31 18:04:05 -04:00
Andrew Kent
bcc5c26ca8 disable with-tr-contracts for now
Running with-tr-contracts as-is takes an unreasonable
amount of time because the tests are run w/o recompiling
typed racket. We need to find a way to make this more
reasonable (i.e. make sure we recompile before running
the unit tests) before enabling them for DrDr again.
2017-03-31 18:01:18 -04:00
Andrew Kent
a7caadcbb1 update travis to included contracted unit tests 2017-03-31 18:01:18 -04:00
Andrew Kent
6a0dc61102 fix metafunction tests (#524) 2017-03-30 19:33:02 -04:00
Andrew Kent
20a73e479f fix minor bug, make funapp code more readable (#521)
* make our inference abstraction macro readable by mere mortals
2017-03-29 21:48:03 -04:00
Andrew Kent
52caac26e8 be more reasonable about constructor contract checking (#522) 2017-03-29 19:15:22 -04:00
Vincent St-Amour
52b4507585 Fix filters of comparisons in the presence of NaN.
Closes #112.
2017-03-28 15:48:37 -05:00
Andrew Kent
1f28ae53cd fix some lexp function contracts (#520) 2017-03-28 13:20:41 -04:00
Andrew Kent
81b134cbb9 add refinement types, linear expr objs, and ineq props (#510)
This PR adds about half of the needed primitives and logic for
reasoning about linear integer arithmetic in programs with interesting
dependent types. Things have been added in a way s.t. programs will
still continue to typecheck as they did, but if you want integer literals
and certain operations (e.g. *,+,<,<=,=,>=,>) to include linear inequality
information by default, you need to include the
'#:with-linear-integer-arithmetic' keyword at the top of your module.

The other features needed to get TR to be able to check things like
verified vector operations will be to ajust function types so
dependencies can exist between arguments and a minor tweak to get
type inference to consider the symbolic objects of functions arguments.
These features should be coming shortly in a future pull request.
2017-03-27 14:32:29 -04:00
Ben Greenman
2804bd4a93 update path-add-extension type with new optional argument (#519) 2017-03-27 10:18:53 -04:00
Andrew Kent
f4aff224a8 update find-relative-path type w/ new keyword (#518) 2017-03-26 09:11:12 -04:00
Andrew Kent
bf0761b500 fix serialization of objects (#516) 2017-03-20 20:57:28 -04:00
Andrew Kent
c174ba655c fix port-> functions to match new kw args in impl (#514) 2017-03-17 13:25:32 -04:00
Andrew Kent
a103ec257b remove broken subtype caching (#513) 2017-03-16 14:09:23 -04:00
Georges Dupéron
5018b478a8 Fixed typo in documentation "splite3" → "sqlite3" (#511) 2017-03-15 10:10:27 -04:00
Vincent St-Amour
1d7b7b5a00 Use new DrRacket opt-in buttons for OC. 2017-03-09 17:12:49 -06:00
Benjamin Greenman
1b62cdfd5a doc: comment on values vs. All (#508)
An `(All (A) ....)` doesn't quantify over `(Values ....)` types
2017-03-06 11:21:13 -05:00
Sam Tobin-Hochstadt
b24507a71b Allow disabling TR optimization with an environment variable. (#504) 2017-03-01 13:19:15 +00:00
Sam Tobin-Hochstadt
b3ab93768f Add types for loop precondition checking functions. (#501)
This is primarily intended for use on the `linklet` branch,
but does not cause problems in other contexts.
2017-02-24 00:33:47 +00:00
WarGrey Gyoudmon Ju
294032c12e improve (get-text) of Text% to accept another two arguments (#499) 2017-02-01 11:24:07 +00:00
Andrew Kent
6334dfb939 fix the maximum range for type-masks 2017-01-30 18:57:04 -05:00
Sam Tobin-Hochstadt
25419f9a9a Add 6.8 HISTORY. 2017-01-17 08:55:20 -05:00
Benjamin Greenman
ed2cf43a19 regression test for issue #33 (#493)
closes #33
2017-01-14 10:56:20 -05:00
Alex Knauth
53d077c27d Move unsupported for*/ forms to the unsupported section (#490)
because the typechecker can't deal with the code they expand to, just like their `for/` partners already in the unsupported section
2017-01-13 13:46:44 -05:00
Vincent St-Amour
41eabc9195 Use existing contract combinators.
To cooperate better with the contract system.
2017-01-10 13:55:13 -06:00
Andrew Kent
b0f707b576 fix Union-fmap bug that skipped some base arg results 2017-01-07 21:43:07 -05:00
Andrew Kent
81255d9a14 misc contract fix 2017-01-07 12:44:48 -05:00
Eric Dobson
3b80ae71f9 correct keyword function conversion
Keyword functions are a little tricky. This PR addresses issues
checking the body of kw functions.

Basically, a function with keyword arguments such as inc:

(define (inc x #:n [n 1])
  (+ x n))

actually expands into a more complex function with 3 arguments that
looks something resembling the following:

(define (inc-expanded n* n-given? x)
   (let ([n (if n-given? n* 1)]) (+ x n)))

and calls to inc are converted to match this form:

(inc 42) => (inc-expanded #f #f 42)

(inc 42 #:n 2) => (inc-expanded 2 #t 42)

Note that each optional keyword argument has a boolean flag argument
that signals whether or not the caller provided that keyword argument.

This PR takes advantage of the observation that the value for the n*
argument in inc is only reachable in code when n-given? is #t, and so,
assuming the kw-expansion protocol always only accesses n* if n-given?
is #t, we can actually safely check the body of the function against
the following simple but correct type:

(-> Number Boolean Number Number)

An alternative previous approach expanded the function type into every
possible combination of optional argument and optional argument flag,
but this was prohibitively expensive.
2017-01-07 12:36:01 -05:00
Asumu Takikawa
e2be0382d1 Remove many uses of dict functions for performance 2017-01-06 15:18:46 -05:00
WarGrey Gyoudmon Ju
3077af848b in-query returns a sequence of single value (#468)
this is an trade-off since dynamically-valued interfaces are almost impossible to typecheck
https://github.com/racket/typed-racket/pull/468

Also, the `SQL-Datum` is now more precision, since `Any` shadows
all opaque types (such as `SQL-Null`) which may lead to contract errors.
2017-01-06 11:34:54 -05:00
WarGrey Gyoudmon Ju
4e02bd44ab Add #lang typed/racket/gui/no-check (#467) 2017-01-06 11:29:04 -05:00
WarGrey Gyoudmon Ju
3cafa94801 Add type annotation for (make-parent-directory*) (#483) 2017-01-06 11:27:42 -05:00
Ben Greenman
3e2d020a19 Implement object/c-opaque-stronger
An opaque object contract is stronger than another (opaque) object contract if:
- it has stronger field/method contracts on fields/methods common to both
- and it has no more field/method contracts than the other, if the other is opaque
2017-01-06 02:41:59 -05:00
Ben Greenman
7c495eea62 fix bug in object/c-clause syntax-class
`field` needs to be a literal; with the bug, the following syntax

```
  (object/c-opaque (any-var (->m any/c)))
```

made a contract with 1 field (named `->m`, value `any/c`)
2017-01-06 02:41:59 -05:00
Andrew Kent
4bfb101677 use bits for base unions, make unions deterministic
This PR primarily changes how we represent Base types and unions of
Base types. Basically, Base types now contain a bits field, which
contains an exact-nonnegative-integer? with exactly one bit set to
1. This allows us to represent unions of Base types by simply OR-ing
together the various base bits. We store these unions in a new type
called a BaseUnion (which contains a field for numeric Base type bits
and a field for non-numeric Base type bits). We can perform set
operations on BaseUnion types rather quickly (using simple bitwise
arithmetic operations).

To make Union and BaseUnion work together nicely, the Union type now
has a field for non-Base types, and a field which contains any and all
Base types placed directly in the Union ( either as a Base if there is
only one, or as a BaseUnion if there are more than one).

Other changes present in this PR:

Base types are now "closed" -- i.e. Base types are only declared in
base-types.rkt and numeric-base-types.rkt with a special macro that
assigns them their respective bits. The constructor make-Base is no
longer provided for miscellaneous usages.

Some singleton Value types were moved to Base so all of our common
unions of basic types can fit into the new BaseUnion type (namely
Null, Void, One, Zero, and the booleans).

A new Val-able match expander lets us match on singleton types that
used to all be Value types, but, as described above, now some are Base
types.

Unions contain deterministically ordered, duplicate free lists (in
addition to sets for equality and constant time membership checks), so
iterating over Unions can be done deterministically (yay!) -- this
gets rid of some otherwise problematic behavior in areas like type
inference, where the order Unions are iterated over can actually
affect the results (i.e. if two valid type inferences are possible,
nondeterministic ordering means we can sometimes get one and sometimes
get another, which makes for particularly difficult to debug issues
and in general has no immediate solution (both substitutions are
valid, after all!))
2017-01-05 20:45:17 -05:00
WarGrey Gyoudmon Ju
e72f2506df Add typed/images/compile-time.rkt (#476) 2017-01-04 17:02:42 -05:00
Benjamin Greenman
b9b3e1a9b9 add typed/file/glob (#440)
* add typed/file/glob

* [typed/file/glob] remove unsafe-provide
2017-01-04 16:48:36 -05:00