Commit Graph

47 Commits

Author SHA1 Message Date
Niko Matsakis cfa09d35a3 Revert "allow fn exprs to omit arg types"
This reverts commit 1ba4ca4c4a.
2012-05-03 14:42:34 -07:00
Niko Matsakis 1ba4ca4c4a allow fn exprs to omit arg types
also, avoid using type variables for fn args with omitted types
unless necessary.  This will be important for bound regions in
fn types.

fixes #2093
2012-05-03 14:32:32 -07:00
Niko Matsakis 2db4259b35 Stop inferring bot/static when types/regions are unconstrained.
Also, some other changes that came up along the way:
- add a 'blk' region for the current block.
- detect unused type/region variables.
2012-04-30 19:53:02 -07:00
Brian Anderson 5eca3c2210 parser: More refactoring of restricted value name checking 2012-04-27 16:45:54 -07:00
Brian Anderson 21dc41649b parser: Remove a restricted keyword check
I can't find a way to trigger this error
2012-04-27 16:45:54 -07:00
Brian Anderson 48368c5a07 test: Add test for two restricted keyword cases 2012-04-27 16:45:54 -07:00
Brian Anderson bde5a842ce parser: Make parse_value_path use parse_value_ident 2012-04-27 16:45:54 -07:00
Brian Anderson 8ab9efe262 parser: Rewrite parse_path_without_tps so it knows beforehand which is the last ident
Needed to centralize all keyword-as-value parsing in parse_value_ident
2012-04-27 16:45:54 -07:00
Brian Anderson beece25abe parser: Fix lookahead of > 1 token 2012-04-27 16:45:54 -07:00
Brian Anderson 345a21916c syntax: Refactor ident parsing 2012-04-27 16:45:54 -07:00
Tim Chevalier 8e15640ada Refactor operator precedence code
Use functions instead of a dynamically created table to determine
operator precedence. Gets rid of a FIXME in syntax::parse::prec.
Change precedences from int to uint while we're at it, since
don't use negative precedences.
2012-04-26 16:16:18 -07:00
Niko Matsakis 825fd1808e lots of work to make iface/impls parameterized by regions
- paths can now take region parameters, replacing the dirty hack
  I was doing before of abusing vstores.  vstores are now a bit
  of a hack though.

- fix various small bugs:
  - we never checked that iface types were compatible when casting
    to an iface with `as`
  - we allowed nonsense like int<int>
  - and more! (actually that may be it)
2012-04-25 19:26:56 -07:00
Brian Anderson c9e3f387f4 syntax: Divide keywords into contextual/restricted. No bad words 2012-04-24 22:58:00 -07:00
Brian Anderson 98ac8d4625 syntax: Clean up the bad_expr_word functions 2012-04-24 21:12:16 -07:00
Brian Anderson 7ee90cc7be syntax: Rename is_word to is_keyword, etc. 2012-04-24 21:08:49 -07:00
Tim Chevalier f7641286b2 Allow classes to be cast to ifaces that are in the same crate
I had to xfail one existing test case (class-implements-int) because,
I think, of the same bug described in #2272.
2012-04-23 21:15:03 -07:00
Marijn Haverbeke a872a99bfe Simplify representation of ast::path 2012-04-23 13:04:46 +02:00
Brian Anderson 512927573e syntax: Replace token::DOLLAR_PAREN, DOLLAR_NUM with just DOLLAR
Figure the rest out in the parser
2012-04-22 17:24:49 -07:00
Brian Anderson 7321c17171 syntax: Eliminate token::POUND_LT, POUND_LBRACE
Use lookahead in the parser
2012-04-22 15:19:14 -07:00
Brian Anderson 7235f3cee2 syntax: Eliminate 'mutable' keyword. Closes #2254 2012-04-21 14:27:20 -07:00
Tim Chevalier 37b0549730 Add new syntax for patterns that match the head constructor only
Adds a new kind of pattern C(*) where C is a constructor that may
have any number of fields. This pattern matches any value
constructed with C, without binding names for any of the fields.

Closes #1701.
2012-04-20 00:56:46 -07:00
Brian Anderson 7fa7e56341 syntax: Move fn spanned into ast_util 2012-04-19 21:58:45 -07:00
Brian Anderson bcbcbad774 syntax: Extract some functions into mod common 2012-04-19 21:58:45 -07:00
Brian Anderson 628e80d525 syntax: Extract attribute parsing to its own mod 2012-04-19 21:58:45 -07:00
Niko Matsakis 3d6c79109e update syntax to include a slash 2012-04-19 21:01:11 -07:00
Niko Matsakis 3c995fb8f3 make nominal types optionally parameterized by a self region.
Issue #2201.
2012-04-19 21:01:11 -07:00
Tim Chevalier 31ff64c62d Annotate FIXMEs in parser
Also, get rid of two FIXMEs by refactoring some code, and moving the
call_expr check for be expressions into typeck, where it seems to
make more sense.
2012-04-19 19:17:59 -07:00
Brian Anderson b9ae0c555b syntax: Funnel all words through a single keyword table 2012-04-19 16:59:28 -07:00
Brian Anderson 9a8a04629e syntax: Put the main parser interface in mod parse 2012-04-18 10:50:50 -07:00
Brian Anderson 2c0cb901c8 syntax: Begin moving functions from mod parser to mod classify 2012-04-18 10:50:50 -07:00
Brian Anderson d51973a6a6 syntax: Move some functions from parser to token 2012-04-18 10:50:50 -07:00
Brian Anderson 476d5a099d syntax: Extract prec mod from parser mod 2012-04-18 10:50:50 -07:00
Brian Anderson 321ccc123d syntax: Add explicit exports in parser mods 2012-04-17 20:10:58 -07:00
Brian Anderson fac7fcc123 syntax: Remove extra 'mut' from bad word table 2012-04-17 14:22:47 -07:00
Niko Matsakis 35a93e61d4 rewrite region resolution so it takes place in typeck 2012-04-16 19:48:00 -07:00
Brian Anderson 2319c2d1ba syntax: lexer doesn't need a codemap 2012-04-15 03:57:24 -07:00
Brian Anderson 0e87f9ed02 syntax: Eliminate token's dependency on lexer 2012-04-15 03:44:32 -07:00
Tim Chevalier 1adc26d5e7 Annotate FIXMEs in syntax::ast and syntax::ast_util
The main non-comment change was to change simple_path to path,
as per a FIXME in ast.
2012-04-13 01:46:56 -07:00
Tim Chevalier 5c12cd72f4 Allow classes to implement ifaces
Introduce syntax like:

iface animal { ... }
class cat implements animal { ... }

to allow classes to implement ifaces. Casting classes to ifaces
is *not* yet supported. ifaces that a class implements are not
yet included in metadata.

The syntax is subject to change, and may go away completely if we
decide to use duck typing to relate classes with ifaces (see
http://smallcultfollowing.com/babysteps/blog/2012/04/10/declared-vs-duckish-typing/ )
2012-04-11 16:20:01 -07:00
Brian Anderson d65df5d4d4 rustsyntax: i64, not int 2012-04-11 13:28:57 -07:00
Graydon Hoare aeca5bae90 Fix name. 2012-04-11 11:08:40 -07:00
Graydon Hoare 7a3b290245 Add vstore/evec/estr to compiler. 2012-04-11 11:08:40 -07:00
Marijn Haverbeke fc202ca034 Remove support for old-style for
Closes #1619
2012-04-06 20:38:23 +02:00
Marijn Haverbeke c902eafa14 Convert old-style for loops to new-style
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.

(This hack will go away soon.)

Issue #1619
2012-04-06 20:38:23 +02:00
Niko Matsakis 051f24da25 add static region and also fix regions to be contravariant 2012-04-05 21:16:28 -07:00
Tim Chevalier 1f892dcb01 Monomorphize class constructors, support generic classes and class methods
Allow class methods to have type parameters (this is a change from the
original classes proposal).

Add test cases for classes with type parameters, and classes with methods
that have their own type parameters.
2012-04-03 16:23:50 -07:00
Brian Anderson 442d0a783a rustc: Move attr, parse, print to rustsyntax 2012-03-29 14:42:31 -07:00