Commit Graph

182 Commits

Author SHA1 Message Date
Stevie Strickland
91291ba2bc Add the forall Unicode symbol as an acceptable replacement for the
All type constructor.

svn: r10797
2008-07-16 17:37:05 +00:00
Stevie Strickland
0cd54c9e33 Merging in the following code:
svn merge -r10197:10773 http://svn.plt-scheme.org/plt/branches/samth/dots
svn merge -r10210:10737 http://svn.plt-scheme.org/plt/branches/samth/dots-tests

This adds non-uniform variable-arity polymorphism to Typed Scheme.

svn: r10778
2008-07-15 19:03:59 +00:00
Stevie Strickland
39c343ec18 Add filter-map to base-env.ss 2008-07-15 00:33:14 -04:00
Stevie Strickland
8842fb9ea0 Add printing if a starred type was substituted in as well. 2008-07-14 09:42:45 -04:00
Sam Tobin-Hochstadt
2866efd348 logging 2008-07-14 08:48:14 -04:00
Stevie Strickland
b991505297 Just tried the following program:
#lang typed-scheme

(require/typed
  srfi/1
  (fold (All (a b) ((a b -> b) b (Listof a) -> b))))

And got an error because (orig-module-stx) was #f.  I'm not sure whether
it should have been or not, but I've fixed up this to handle that case
(having it just use the normal error message when that's #f, as I'm not
sure whether the error message would be correct otherwise).

However, it might just be that (orig-module-stx) should have not been
#f, in which case this should be checked out.
2008-07-13 21:47:36 -04:00
Sam Tobin-Hochstadt
2456dcc18b Fix handling of mutable structs (setters != getters)
Allow use of #:mutable as define-typed-struct arg
Fix types of random andmap ormap
2008-07-13 17:31:58 -04:00
Stevie Strickland
421df42d00 Switch these over to for/for*. Avoid the hash-copy calls as well, since
we either end up doing the traversal wholesale or throwing some of that
work away by removing items.
2008-07-13 12:14:15 -04:00
Stevie Strickland
fdfc8d7b78 Add comment explaining what's going on here. 2008-07-13 06:14:23 -04:00
Stevie Strickland
e0bad1987d Was thinking of doing some cleanups here, but at the very least I can
get rid of this useless remove, since it's just going to overwrite it
anyway if we don't remove it first.
2008-07-13 06:12:06 -04:00
Stevie Strickland
9f6427ac34 This makes the change mentioned in the log message for r10735 (the previous
revision). So what we'll get here is the following:

Dotted + Dotted = Dotted (from the first case)
Dotted + x      = x      (since x refers to a free use of the dotted var)
x      + Dotted = x      (same)

I think this is correct.
2008-07-12 22:33:04 -04:00
Stevie Strickland
f3eb315425 I'm not sure if this is correct, but this handles the cases where we're
instantiating dotted pre-types where the bound is _not_ free in the
pre-type base.  I checked in a test case for this, that's something like:

(inst (plambda: (a ...) [ys : (Number ... a -> Number)] (apply + ys))
      Integer Boolean String)
 =
(Number Number Number -> Number)

These changes introduce no extra test failures, and we really have to
account for the bound here, and really even if the variable _does_
appear free within the pre-type base, it shouldn't be counted as a
"regular" variable outside of that scope.

Actually, maybe Dotted should behave like Constant, where it just
propogates until there's a separate free use that we're merging with,
in which case we just treat it like the free use (which will
eventually get fix-bound applied to it anyway).  I think I'll make
that change next.
2008-07-12 22:30:00 -04:00
Stevie Strickland
9b289bea27 Actually, I want to be careful with this.
For example, we don't want the result type of the function to be free,
so it's more like:

G, D + {a}, S |- f : (t1 t2 -> t)
G, D, S |- t

(i.e. {a} not free in t)

Hmm.
2008-07-12 22:20:10 -04:00
Stevie Strickland
274814e6aa There's no reason we can't allow foldl on a rest arg, as long as the types
match up appropriately.  Let's do it!
2008-07-12 22:13:44 -04:00
Stevie Strickland
ab2360384f We have to be careful here -- for example, one of the test cases was failing
because the last thing in the instantiate was a function type, which is
a cons.  Look for a cons whose cdr is an identifier.
2008-07-12 22:11:23 -04:00
Eli Barzilay
7d50e61c7f * Newlines at EOFs
* Another big chunk of v4-require-isms
* Allow `#lang framework/keybinding-lang' for keybinding files
* Move hierlist sources into "mrlib/hierlist", leave stub behind

svn: r10689
2008-07-09 07:18:06 +00:00
Sam Tobin-Hochstadt
eed2c37495 Need to do the same for regular Poly as well. 2008-07-07 19:33:08 -04:00
Sam Tobin-Hochstadt
b835002d72 Finally found a nasty bug involving variables not appearing in the hash table. 2008-07-07 19:21:42 -04:00
Sam Tobin-Hochstadt
6a607be6a9 If there are extra effects, let them be. 2008-07-07 17:15:43 -04:00
Sam Tobin-Hochstadt
8599321b57 Add check that effect lists have same length. 2008-07-07 17:04:09 -04:00
Sam Tobin-Hochstadt
f9c91d6b8a Constraining with bottom produces trivial constraints, not missing constraints. 2008-07-07 16:54:46 -04:00
Sam Tobin-Hochstadt
589ba9d77a Add require of scheme/promise for force.
Handle call-with-values more appropriately.
2008-07-07 16:43:12 -04:00
Sam Tobin-Hochstadt
4758c0b14d Better check for 'is this error from a macro' 2008-07-07 15:54:19 -04:00
Sam Tobin-Hochstadt
2de55888f1 handle nested polymorphic types in the expected type of a lambda 2008-07-07 15:36:33 -04:00
Sam Tobin-Hochstadt
acd6664c52 Fix call with correct # of args. 2008-07-07 15:24:09 -04:00
Sam Tobin-Hochstadt
17dec0046f Remove debugging code. 2008-07-07 15:05:51 -04:00
Sam Tobin-Hochstadt
807336e262 Actually check that lengths are equal. 2008-07-07 15:03:23 -04:00
Sam Tobin-Hochstadt
2844dec0a1 make-Values now checks its argument for having only 1 element 2008-07-07 14:58:22 -04:00
Sam Tobin-Hochstadt
d0939ffa1e Fix up singleton values 2008-07-07 14:49:46 -04:00
Sam Tobin-Hochstadt
044bd551b0 stevie is magic 2008-07-07 14:39:10 -04:00
Sam Tobin-Hochstadt
61cefef89c More info in internal errors.
Fix substitution in nested ... case.
2008-07-07 14:25:15 -04:00
Sam Tobin-Hochstadt
3cd8878999 This shouldn't be here :p 2008-07-07 13:13:32 -04:00
Sam Tobin-Hochstadt
e06a22c29b remove trace 2008-07-07 12:27:08 -04:00
Sam Tobin-Hochstadt
c43c3baa67 values with dots 2008-07-07 11:01:42 -04:00
Stevie Strickland
1aaa6995a1 Try to handle type errors in non-original syntax a bit better. 2008-07-03 12:03:18 -04:00
Sam Tobin-Hochstadt
c9e8f6d6f6 Refactoring. 2008-07-01 16:44:49 -04:00
Sam Tobin-Hochstadt
12b7c6c459 Fix handling of dotted <: starred hard case 2008-06-24 11:43:30 -04:00
Stevie Strickland
705685af8b Add stuff that isn't useful yet, but might be useful for a lattice for future
work.
2008-06-20 20:03:56 -04:00
Stevie Strickland
6a8b7e2e14 We should infer on the dotted var also, for the case where the underlying
function's type and/or the arguments to said function use it.
2008-06-20 17:49:43 -04:00
Stevie Strickland
a6ea8d7954 Revert last change. 2008-06-20 15:47:56 -04:00
Sam Tobin-Hochstadt
0366745cbf Use the X from cgen/list to create the empty cmap.
This allows (vector) to have type (Vectorof (U))
2008-06-20 15:27:46 -04:00
Sam Tobin-Hochstadt
b57519d398 Be AR about order of arguments to cgen* (cgen/list took X V, not V X) 2008-06-20 14:52:53 -04:00
Sam Tobin-Hochstadt
a6cd9ea2cd * Fixed calls to infer that didn't give must-vars argument
* Fixed promote/demote so they check the dotted bound, not free vars of type
 * Stopped promote/demote from promoting/demoting away dotted bound
 * Stopped promotion/demotion of dotted bound in cgen/arr
 * Improved debug macro
2008-06-20 14:48:47 -04:00
Sam Tobin-Hochstadt
6296ffbfcf * Added code to check that substitution gets rid of all appropriate
variables (and fails if not)
 * Added weird dotted as subtype of * case (dcon-exact)
2008-06-20 13:07:08 -04:00
Stevie Strickland
654d7e2f46 * Add the ability to substitute in starred types for dotted when
we've inferred it.
 * Try and consolidate a lot of the error printing with domain mismatches.
2008-06-19 19:14:32 -04:00
Sam Tobin-Hochstadt
0f142d97e3 Do substitution properly from dmap. 2008-06-19 18:04:19 -04:00
Sam Tobin-Hochstadt
b9e1676a55 * Add constraints when matching t1...a to t2...b
* Do inference when you have (apply f ... xs), f and xs are dotted,
   and on different bounds.
 * Add fold-right to extra-procs and its type to base-env
2008-06-19 16:55:06 -04:00
Sam Tobin-Hochstadt
bb8d8e23d8 * Split apart identifier typechecking and type instantiation
* Add dotted instantiation (replacing bounds with different bounds)
 * Fix some macro issues, including syntax locations
 * Fix more effect inference
2008-06-19 14:57:35 -04:00
Sam Tobin-Hochstadt
1880eb4afb Fix filter type.
svn: r10374
2008-06-19 16:07:12 +00:00
Sam Tobin-Hochstadt
3fd969651f Fix type of filter, and inference w/ effects. 2008-06-19 11:57:07 -04:00