Commit Graph

69 Commits

Author SHA1 Message Date
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
Andrew Kent
8e7f39025a remove interning for most Reps in TR
Prior to this change (which was Typed Racket PR 469) all internal TR
objects (Reps) were interned and kept around for the entire duration
of type checking.  Because of this, frequent operations that rebuilt
types were particularly costly (e.g. various forms of
substitution). To recoup some of this cost, caching was being used in
a lot of places. This PR sought to remove interning as the default
behavior for Reps and allow for more flexibility in how we approach
time/space performance needs going forward.

The following changes were included in this overhaul:

Interning: All Reps are no longer interned. Right now we only intern
unions and some propositions.

Rep generic operations: we now use racket/generic so we're not
reinventing this wheel.

Singletons: Reps (e.g. TrueProp, Univ, etc) can be declared singleton,
which creates a single instance of the rep that all visible operations
(even within the declaring module) are defined in terms of
(e.g. predicates are defined as (λ (x) (eq? x singleton-instance)),
etc).

Custom constructors: Custom constructors can be specified for Reps,
which allows for simple normalization, interning, or other invariants
to be enfored whenever a Rep is created.

Union: Unions used to try to ensure no obviously overlaping types
would inhabit the same Union (e.g. (U String (Pairof Any Any) (Pairof
Int Int)) would be simplified to (U String (Pairof Any Any))). This,
however, required frequent calls to subtyping every time a Union was
modified and working with Unions thus had a high cost (another thing
that caching was used to reduce). Instead of this, Unions now enforce
a much simpler set of invariants on their members: (1) No duplicates
(by virtue of using a hash-based set), (2) Any and Nothing do not
appear in unions, and (3) Nested unions are flattened. Also, using a
hashset as the internal data structure meant that we could easily
intern unions w.r.t. equal? equality. NOTE: we do reduce unions to not
contain obviously overlapping terms when printing to users and when
generating contracts (so obviously and avoidable inneficient contracts
are not generated – See union.rkt for 'normalize-type').

Subtyping changes: Subtyping has been designed to reduce dispatch time
w/ a switch since we no longer cache _all_ subtyping calls (we only
cache subtyping results for unions since they have some costly
subtyping).

prop-ops changes: AndProps now are careful to sort OrProps by length
before building the resulting proposition. This is done because
OrProp implication only checks if one Or is a subset of another Or.
By ordering Or props by size, we only ever check if an OrProp implies
another if its size is <= the other OrProp. This also makes the
smart constructor '-and' more robust, since the order the props
appear does not affect if some Ors are kept or not.

Testing: More subtype tests have been added (we are still probably
relying too much on typecheck-tests.rkt and not the more granular unit
tests in general).  Also, typecheck-tests.rkt has been changed to
check for type-equivalence (i.e. subtyping in both directions)
instead of equal? equivalence.
2016-12-16 15:18:50 -05:00
WarGrey Gyoudmon Ju
90a4d73414 Add typed/setup/getinfo (#472) 2016-12-15 16:51:33 -05:00
WarGrey Gyoudmon Ju
1c3a0a1f34 improvement: (get-display-backing-scale) returns Positive-Real (#462) 2016-11-27 12:43:49 -05:00
Andrew Kent
24c64e9de0 new representation scheme for typed racket internals
This is a major to some of the internal representation of things
within Typed Racket (mostly affecting structs that inherited from Rep
(see rep/rep-utils.rkt)), and lots of tweaks and bug fixes that
happened along the way.

This PR includes the following major changes:

A new rep-utils implementation, which uses struct properties for the
generic operations and properties of the various Reps (see
rep-utils.rkt)

More specific Rep inheritance (i.e. arr no longer inherits from Type,
because it is not a Type, etc ...) (see type-rep.rkt, core-rep.rkt,
values-rep.rkt), and thus things like Type/c no longer exist

New Rep's to classify the things that are no longer Type or Prop,
(such as PropSets, SomeValues, Results, etc -- see core-rep.rkt and
values-rep.rkt)

uses of type-case now replaced by uses of Rep-fold and Rep-walk

structural types can specify their fields' variance and operations
like subtyping and free-vars can generically operate over these types
(see type-rep.rkt)

type-mask replaces types key -- types masks are described in detail in
(rep/type-mask.rkt)

Types can specify a predicate to recognize their "top type" via [#:top
pred])

There is an explicit 'Bottom' type now (i.e. neither union or
intersection are used)

subtyping re-organized, slight tweaking to inference

various environments got for-each functions in addition to the map
functions they had (e.g. type-name-env.rkt)

Empty is no longer an Object? -- the OptObject? predicate checks for
either Object or Empty, and so it is easier to be clear about where
Empty makes sense appearing and where it does not

Previously signatures were created with promises in their fields, now
we create a promise around each signature (this way the contracts for
Signature fields are cleaner)

Names for structs now use the args field to describe how many type
arguments they take (Note: this could use further tidying for sure!)

simplified the propositional logic code in several places, got rid of
escape continuations, etc (see prop-ops.rkt, tc-envops.rkt,
tc-metafunctions.rkt)

we now use subsumption more to simplify type results from type
checking, e.g. if the type does not overlap w/ false, it's false
proposition is FalseProp, etc (see tc-expr-unit.rkt and prop-ops.rkt,
the function is called reduce-tc-results/subsumption)

updating along a path will now intersect with the expected structural
type if it is not encountered (e.g. updating Any with (Int @ car) now
produces (Pairof Int Any) instead of Any -- see update.rkt)

lots of tests were tweaked to match up w/ the new prop subsumption
that occurs

remove was renamed subtract (so as to not conflict w/ racket/base's
remove)

a restrict function was added, which acts like intersect but is never
additive (i.e. it will never create an intersection if it can't figure
out how the two types relate -- see intersect.rkt)

tc-subst was modified to substitute out all the variables leaving
scope at once (and I simplified/tweaked some of the logic in there a
little, see tc-subst.rkt)

Type checking function applications now propagates information learned
why type checking the arguments, (e.g. (begin (f (assert x boolean?))
...)) ; the remainder of the begin is aware that x is a boolean)
2016-10-21 14:24:27 -04:00
WarGrey Gyoudmon Ju
efecd24e9d Improvements on typed/images/logos.rkt and typed/images/icons.rkt (#443) 2016-10-17 17:51:33 -04:00
WarGrey Gyoudmon Ju
e706928a77 Improve type annotation of (get-backing-scale) (#424) 2016-09-08 16:23:40 -04:00
Sam Tobin-Hochstadt
07911cd613 Fix type of get-value in Slider%.
Reported by Tim Brown.
2016-09-07 08:53:03 -04:00
WarGrey Gyoudmon Ju
abdc0e8ebc Add support for db/base and db/sqlite3 (#419) 2016-09-01 12:04:36 -04:00
WarGrey Gyoudmon Ju
835cfcd7ea add typed/racket/os.rkt (#391) 2016-07-08 20:40:52 -04:00
Alex Knauth
8c0a5a0b3e Add typed/syntax/modread, typed/syntax/srcloc, and typed/syntax/readerr (#353)
* add typed/syntax/modread.rkt

* add typed/syntax/srcloc.rkt

* add typed/syntax/readerr.rkt
2016-07-07 12:20:40 -04:00
WarGrey Gyoudmon Ju
5552101f5b Add some useful type definitions (#356) 2016-05-19 17:49:20 -04:00
Andrew Kent
f9c5a534d0 filter -> prop
This pull request is largely a renaming effort to clean up the TR codebase. There are two primary things I wanted to change:

1. Replace all occurrences of "filter" with "prop" or "proposition"
   - The word "filter" is a meaningless opaque term at this point in the Typed Racket implementation. If anything, it just adds confusion to why things are the way the are. We should use "proposition" instead, since that's what they actually are.

2. Avoid using "Top" and "Bottom" in both the type and proposition realm.
   - Currently the top type is called Univ and the bottom type is called bottom, while the top proposition is called Top and the bottom proposition is called Bot. This is just unnecessarily confusing, doesn't really line up w/ the user-space names, and doesn't line up with the names we use in TR formalisms. Worse, all of the top types of primitive types---e.g. the type of all structs, StructTop--- use Top, so it is really easy to get confused about what name to use for these sorts of things.

With these issues in mind, I made the following changes to names:

Top -> TrueProp
Bot -> FalseProp
TypeFilter -> TypeProp
NotTypeFilter -> NotTypeProp
AndFilter -> AndProp
OrFilter -> OrProp
-filter t o -> -is-type o t
-not-filter t o -> -not-type o t
FilterSet -> PropSet
NoFilter -> #f
NoObject -> #f
-FS -> -PS
-top -> -tt
-bot -> -ff
implied-atomic? q p -> implies-atomic? p q
filter-rec-id -> prop-rec-id
-no-filter -> -no-propset
-top-filter -> -tt-propset
-bot-filter -> -ff-propset
-true-filter -> -true-propset
-false-filter -> -false-propset
PredicateFilter: -> PredicateProp:
add-unconditional-filter-all-args add-unconditional-prop-all-args
2016-04-25 18:36:12 -04:00
WarGrey Gyoudmon Ju
65441301c2 Add typed/images/logos and typed/images/icons without #:material support 2016-04-07 17:03:05 -04:00
Asumu Takikawa
1a11ac53e2 Add typed/racket/random, bump version 2016-04-07 15:03:57 -04:00
WarGrey Gyoudmon Ju
0d45168aee Fixup wrong type definition: set-caret-owner, it needs (Instance Snip%) 2016-04-07 09:33:46 +08:00
WarGrey Gyoudmon Ju
bf24ebdd65 Fixup a typo in the definition of (make-font); Fixup the wrong definition of (get-filename); Provide editor-snip% with Editor-Snip% 2016-04-06 16:25:28 -04:00
Georges Dupéron
4ab256abf2 Fixes GH issue #315 Syntax properties are not forwarded by define-typed/untyped-identifier, following @samth's suggestions. 2016-04-06 12:06:42 -05:00
WarGrey Gyoudmon Ju
e0d067c99a Fixup wrong type definitions. (set/get-keymap) and (get-snipclass) 2016-02-16 16:47:05 -06:00
ben
89a58bf670 vscoll -> vscroll 2016-02-04 17:24:25 -05:00
Sam Tobin-Hochstadt
23bda72953 Add missing function to typed/rackunit implementation.
Repairs 10dc53375. Found by the "semver" package.

Merge to 6.4.
2016-02-01 21:34:10 -05:00
Asumu Takikawa
1f5c5144f9 Fix type of make-brush
Closes issue #104
Closes PR 14931
2016-01-13 07:56:01 -05:00
Spencer Florence
2139c776d8 adding new pict function 2016-01-01 16:22:31 -06:00
Sam Tobin-Hochstadt
10dc533751 Succcessfully typecheck new rackunit test-begin expansion. 2015-12-21 19:46:21 -05:00
Sam Tobin-Hochstadt
b00f74dad2 Avoid local-expand in typed/rackunit.
Fixes build problem.
2015-12-21 15:36:56 -05:00
Vincent St-Amour
439e0ba650 Required in wrong module. 2015-12-18 16:49:59 -06:00
Vincent St-Amour
f9e3418d8a Only show OC button in DrR when the tool is actually loaded.
Closes PR13344.
2015-12-18 15:58:40 -06:00
Jordan Johnson
ea9467c826 net/url: fix PortT/Bytes, HTTP-Connection
* PortT/Bytes now correctly lists the Bytes parameter as _not_ optional. (For that matter, so does PortT/String.)
 * HTTP-Connection was defined as an opaque type in net/url, but really is the same type defined in net/http-client, so now it is imported from there.
2015-11-15 20:12:11 -08:00
Earl Dean
be29c556cd added missing optional checked aurgument to Checkable-Menu-Item% in gui-types.rkt 2015-11-12 12:14:30 -05:00
WarGrey Gyoudmon Ju
dc73660242 Add typed/web-server/http.rkt, typed/web-server/configuration/responders.rkt
Closes #153.
2015-11-10 16:32:20 -05:00
AlexKnauth
cf4a033872 fix issue #166 2015-08-03 18:36:14 -05:00
Sam Tobin-Hochstadt
d20c74e22a Fixes for Robby's change to tooltip.rkt.
* Add `get-size` to `Font%`.
* Relax types on `find-or-create-font` in line with docs.
* Add `basic-style` to `Style-List%`.
2015-07-29 14:28:23 -07:00
Asumu Takikawa
3e0e3a4005 Add keyword argument for get/set-argb-pixels
Also simplify the types for bitmap-dc% too
2015-04-14 17:53:32 -04:00
Asumu Takikawa
c3a87fc5dd Add a type for get-display-backing-scale 2015-04-10 18:57:35 -04:00
Asumu Takikawa
8c329d4ddf Fill in types for GUI ref section 4 2015-03-27 01:02:36 -04:00
Asumu Takikawa
f82ceece33 Add other missing exports for typed/racket/draw 2015-03-27 00:13:15 -04:00
Asumu Takikawa
f758a6ed42 Add record-dc% in typed/racket/draw 2015-03-26 23:07:07 -04:00
Alexis King
85cbafc534 Fix the type of current-https-protocol in typed/net/url-connect 2015-03-26 09:06:16 -07:00
Alexis King
d2745f89eb Modernize typed/net/url 2015-03-25 16:06:52 -07:00
Alexis King
193f3c49c6 Fix the types for pin-over and pin-under in typed/pict 2015-03-13 16:25:33 -07:00
Asumu Takikawa
1999d0251b Allow #lang typed/racket/gui and add base module
This aligns the library structure of typed/racket/gui
to racket/gui.
2015-03-12 17:27:59 -04:00
Alexis King
9ad485e9d6 Update typed/pict to include functions that require the class system 2015-03-04 15:24:33 -08:00
Asumu Takikawa
d30a824f02 Simplify typed/mred and typed/framework/framework
These now just re-export typed/racket/gui and typed/framework
respectively. They are kept mainly for backwards compatibility.
2015-03-04 16:26:35 -05:00
Matthew Flatt
952334927c typed/untyped-utils: adjust scope handling for introduced submodule
Avoid the relying too much on current macro expander's treatment of
syntax that is moved from one module to another.
2015-02-25 21:15:30 -07:00
Asumu Takikawa
f5f6a77dfd Add two mrlib type wrappers 2015-02-25 16:31:37 -05:00
Asumu Takikawa
08ac3a178f Add init-rest args to Font% type 2015-02-25 14:25:17 -05:00
Asumu Takikawa
8931accc7c Add missing types for Frame% 2015-02-23 17:19:16 -05:00
Kat Lyons
47521d263e Add missing type signatures for net/uri-codec 2015-02-13 15:48:16 -07:00
Sam Tobin-Hochstadt
a4252d47f4 Reduce some duplication in these definitions. 2015-02-09 17:43:49 -05:00