Graydon Hoare
fbbc1a77d2
Rewrite everything to use [] instead of vec() in value position.
2011-05-16 18:21:22 -07:00
Tim Chevalier
971b5d5151
Started adding support for return checking and non-returning function annotations
...
* Reorganized typestate into several modules.
* Made typestate check that any function with a non-nil return type
returns a value. For now, the check is a warning and not an error
(see next item).
* Added a "bot" type (prettyprinted as _|_), for constructs like be, ret, break, cont, and
fail that don't locally return a value that can be inspected. "bot"
is distinct from "nil". There is no concrete syntax for _|_, while
the concrete syntax for the nil type is ().
* Added support to the parser for a ! annotation on functions whose
result type is _|_. Such a function is required to have either a
fail or a call to another ! function that is reached in all control
flow paths. The point of this annotation is to mark functions like
unimpl() and span_err(), so that an alt with a call to err() in one
case isn't a false positive for the return-value checker. I haven't
actually annotated anything with it yet.
* Random bugfixes:
* * Fixed bug in trans::trans_binary that was throwing away the
cleanups for nested subexpressions of an and or or
(tests: box-inside-if and box-inside-if2).
** In typeck, unify the expected type arguments of a tag with the
actual specified arguments.
2011-05-16 16:59:25 -07:00
Tim Chevalier
c75125fcce
Noticed that metadata::Encode::enc_sty didn't have a case for ty_task, so I added one (though this wasn't causing the problem I was seeing...
2011-05-16 16:13:11 -07:00
Patrick Walton
f74298215c
rustc: Fix indentation in typeck::check_lit()
2011-05-16 15:24:32 -07:00
Patrick Walton
1fc1ad91ce
rustc: Don't rebuild the call expression in typeck::replace_expr_type()
2011-05-16 15:20:11 -07:00
Patrick Walton
278d64dafc
rustc: Don't unpack annotations in trans::lval_generic_fn()
2011-05-16 15:20:11 -07:00
Patrick Walton
32b8dcb97c
rustc: Factor out the code that interns types into an "interner" data structure
2011-05-16 13:58:13 -07:00
Patrick Walton
3760bfab87
rustc: Don't rebuild AST patterns during typechecking
2011-05-16 11:45:00 -07:00
Patrick Walton
ca51b49c0a
rustc: Replace the redundant typeck::node_ann_ty_params() with ty::ann_to_type_params()
2011-05-16 11:43:50 -07:00
Patrick Walton
3aaf02b907
rustc: Make the type collection pass no longer rebuild the AST
2011-05-16 10:34:32 -07:00
Patrick Walton
525a5c582f
rustc: Fix indentation in ty_param_count_and_ty_for_def()
2011-05-16 10:32:38 -07:00
Patrick Walton
594c70f788
rustc: Add an item_ann() accessor function
2011-05-16 10:32:38 -07:00
Brian Anderson
f77c5ba512
rustc: Wait until generic glue is actually emitted to define it as internal
...
The verifier was not liking this when generating unoptimized bitcode. Per LLVM
docs it is not valid for function declarations to be marked internal, but
their implementations may be.
2011-05-15 19:53:06 -04:00
Brian Anderson
8eaafdaa2d
rustc: Rename 'Unify' modules to 'unify'
2011-05-14 21:13:47 -04:00
Patrick Walton
de421afa55
rustc: Use walk instead of fold for the first item collection pass
2011-05-14 11:03:10 -07:00
Patrick Walton
8b3f359442
rustc: Change "Collect" to "collect"
2011-05-14 11:03:10 -07:00
Patrick Walton
85120d9959
rustc: Look types up in the side table
2011-05-13 18:46:44 -07:00
Patrick Walton
ef75860a0a
rustc: Write nil types into the node type table wherever plain_ann() is used
2011-05-13 17:55:07 -07:00
Lindsey Kuper
5679f5c55e
'with' no longer a token; whitespace police.
...
Plus renaming the anonymous objects test to a more descriptive name,
and XFAILing it because it doesn't work yet.
2011-05-13 17:37:01 -07:00
Lindsey Kuper
cd31d5d532
More anon obj work; whitespace police in middle::fold
...
Passing args to middle::fold::fold_expr_anon_obj by reference to be
consistent with the other folds; adding a dummy fold_expr_anon_obj to
typeck to be filled in later.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
814b17352c
Use new module namespace syntax.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
b6f35c6a4b
More work toward anonymous objects.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
d3242b9644
Bug fixes.
...
Fixed infinite loop on anonymous objects in parser; added
expr_anon_obj to walk.rs; fixed syntax of test case.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6c1c5b3948
More progress on anonymous objects.
...
Still segfaulting on the method-overriding.rs test, though.
2011-05-13 17:35:13 -07:00
Patrick Walton
fac1342513
rustc: Move replace_expr_type() from ty to typeck, as it's only used in the latter
2011-05-13 17:06:30 -07:00
Brian Anderson
843e9435ab
rustc: Fix long lines in typeck.rs
2011-05-13 20:06:02 -04:00
Patrick Walton
23d3b0ec57
rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train
2011-05-13 16:53:35 -07:00
Patrick Walton
0739849e9f
rustc: Make all type lookups go through the one ty::ann_to_ty_param_substs_opt_and_ty() function
2011-05-13 16:40:21 -07:00
Patrick Walton
4f2eb31870
rustc: Write types contained in "trivial annotations" to the table
2011-05-13 16:27:55 -07:00
Patrick Walton
e888fe6f9b
rustc: Change ty::triv_ann() to take a node ID instead of a full annotation
2011-05-13 14:39:00 -07:00
Brian Anderson
2f440b1452
rustc: lowercase the link and link::write modules
2011-05-13 16:55:37 -04:00
Graydon Hoare
0d32ff723a
Slight adjustments to shape, rename to type_glue.rs.
2011-05-13 13:29:50 -07:00
Patrick Walton
c97b05141a
rustc: Add write_type() wherever ann_types are written, except for triv_ann()
2011-05-13 13:06:34 -07:00
Patrick Walton
be9aa1cc5e
rustc: Fix the type of node_types; stub the write_type function
2011-05-13 12:12:54 -07:00
Patrick Walton
6e34679a65
rustc: Remove a minor rustboot workaround in typeck::resolve_local_types_in_block()
2011-05-13 11:23:00 -07:00
Patrick Walton
8a8f68aa75
rustc: Make typeck::instantiate_path() not return an annotation
2011-05-13 10:53:55 -07:00
Marijn Haverbeke
ae26b775b4
Implement module namespaces
...
Module names no longer clash with type and value names. The
tokenizer/parser still needs to be taught to be more careful in
identifying keywords, so that we can use 'str' and 'vec' and so as
module names.
2011-05-13 17:20:46 +02:00
Marijn Haverbeke
eb419fd8c7
Extend crate format to allow multiple definitions for a single name
...
The type/value namespace distinction pretty much works now. Module
namespace is up next.
2011-05-13 17:20:39 +02:00
Marijn Haverbeke
1a12a7b04b
Make module indices hold a list of items
...
This way, they can support having both a type and a value
of the same name.
2011-05-13 13:34:59 +02:00
Marijn Haverbeke
58ec5d1654
Move capture checking into resolve.rs
...
Drops capture.rs. The new algorithm also checks for captures function
arguments and obj fields.
2011-05-13 12:44:05 +02:00
Marijn Haverbeke
89490e416b
Change resolve to use walk instead of fold
...
Possibly, at some point, we should add a state-passing variant of
walk, or a wrapper that makes it easier to thread state. (See the
repetetive pop_state_for_* functions in this commit.)
2011-05-13 11:35:25 +02:00
Marijn Haverbeke
7082bf4478
Ensure visit_ty is called on type parameters during walk
2011-05-13 11:35:25 +02:00
Marijn Haverbeke
39a000714a
Add visit_arm and visit_method to walk.rs
...
The resolver needs to update its state for individual arms and
methods.
2011-05-13 11:34:51 +02:00
Patrick Walton
5295a4dabd
rustc: Flatten recursive vectors in trans::simplify_type(). Prevents an infinite loop.
2011-05-12 18:37:28 -07:00
Patrick Walton
b163247d4e
rustc: Beginnings of a "shape" module to convert types to shapes
2011-05-12 18:30:21 -07:00
Patrick Walton
033b38b636
rustc: Make ty::expr_ann() terser
2011-05-12 16:57:08 -07:00
Patrick Walton
0b7dd0d918
rustc: Pass a node type table around, unused as of yet
2011-05-12 16:41:55 -07:00
Graydon Hoare
5ceaf345ed
Add stats option and lazily emit glue.
2011-05-12 15:42:51 -07:00
Marijn Haverbeke
3816e57fd2
Downcase std modules again, move to :: for module dereferencing
...
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
6510f1ce7c
Change module dereference syntax from . to ::
...
This will need to be a snapshot.
2011-05-12 21:30:35 +02:00