about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2011-07-06Swap the expected/actual for typechecking fields of updated recordsBrian Anderson-0/+9
In 'rec(a = b with c)', if a exists in c then the expected type for b is the type of c.
2011-07-06Add a compile-fail test for attempts to extend non-objects.Lindsey Kuper-0/+13
2011-07-05Require that the meta items in a use statement have unique namesBrian Anderson-0/+7
2011-07-05Error if the link attribute has duplicate items. Issue #614Brian Anderson-0/+7
2011-07-05Add a test file for distinct ty_native typesMarijn Haverbeke-0/+7
This should have gone into patch 77f5d14f14630da997f13de28ea86e8320957180, had I not forgotten to add the file.
2011-07-03Make non-str fail expression a type checking failure instead of a ↵Josh Matthews-0/+5
translation one.
2011-07-02Fix assertion failure when syntax extension name is missing.Josh Matthews-0/+5
2011-07-02Fix the error-pattern on compile-fail/fail-simpleBrian Anderson-1/+1
Recent changes to the fail statement changed the way the parser errors in this scenario.
2011-07-01Add a test for mismatched crate metadata in use statementsBrian Anderson-0/+5
2011-07-01Implement autoderef for function calls.Michael Sullivan-0/+7
This is important since we are going to be making functions noncopyable soon, which means we'll be seeing a lot of boxed functions. (*f)(...) is really just too heavyweight. Doing the autodereferencing was a very little bit tricky since trans_call works with an *lval* of the function whereas existing autoderef code was not for lvals.
2011-06-29Re-enable tidy (it was broken) and fix various non-tidy things.Graydon Hoare-13/+13
2011-06-28Support attaching attributes to modules via the crate file. Issue #487Brian Anderson-1/+1
2011-06-28Require that both sides of a swap be lvals.Michael Sullivan-0/+5
2011-06-28Add test case for non-matching crate metadata in use statementsBrian Anderson-0/+4
2011-06-28Another test for typestate and expr_fnTim Chevalier-0/+10
2011-06-28Handle lazy binops properly in typestateTim Chevalier-0/+18
The typestate analysis now reflects that the second operand of a logical and or or may not be evaluated.
2011-06-28Tests only: more tests with constraints and loopsTim Chevalier-0/+53
2011-06-28Use 'resource' rather than 'res' as a keywordMarijn Haverbeke-1/+1
Resources are now defined like... resource fd(int n) { close(n); } Calling fd with an int will then produce a non-copyable value that, when dropped, will call close on the given int.
2011-06-28Add test cases for resourcesMarijn Haverbeke-0/+8
2011-06-28'#simplext' -> '#macro'Paul Stansifer-2/+2
2011-06-28Add simple syntax extension (#simplext)Paul Stansifer-1/+14
2011-06-27Tests for while loops that may invalidate constraintsTim Chevalier-0/+34
Wrote some small test cases that use while loops and moves, to make sure the poststate for the loop body gets propagated into the new prestate and deinitialization gets reflected. Along with that, rewrite the code for intersecting states. I still find it dodgy, but I guess I'll continue trying to add more tests. Also, I'll probably feel better about it once I start formalizing the algorithm.
2011-06-25Fail typechecking for bad binop/type combinationsBrian Anderson-0/+51
Includes assignment operations. Add regression tests for lots of less useful, less used or unexpected combinations, as well as a selection of compile-fail tests. Closes #500 (again!)
2011-06-25Add a test for mismatched types when comparing functionsBrian Anderson-0/+8
2011-06-25Remove variable name 'res' from test suiteMarijn Haverbeke-1/+1
2011-06-24Invalidate constraints correctly after an assignment expressionTim Chevalier-0/+40
Modified typestate to throw away any constraints mentioning a variable on the LHS of an assignment, recv, assign_op, or on either side of a swap. Some code cleanup as well.
2011-06-24Add a test that tests typestate checking inside of fn exprs.Michael Sullivan-0/+11
2011-06-23Correct error message for argument mode mismatchTim Chevalier-0/+9
If you use a function expecting an alias argument in a context that expects a function expecting a value argument, or vice versa, the previous error message complained that the number of arguments was wrong. Fixed the error message to be accurate.
2011-06-22Compute typestate properly for moveTim Chevalier-0/+6
typestate now drops constraints correctly in the post-state of a move expression or a declaration whose op is a move. It doesn't yet drop constraints mentioning variables that get updated. To do this, I had to change typestate to use trit-vectors instead of bit-vectors, because for every constraint, there are three possible values: known-to-be-false (e.g. after x <- y, init(y) is known-to-be-false), known-to-be-true, and unknown. Before, we conflated known-to-be-false with unknown. But move requires them to be treated differently. Consider: (program a) (a1) x = 1; (a2) y <- x; (a3) log x; (program b) (b1) x = 1; (b2) y <- z; (b3) log x; With only two values, the postcondition of statement a2 for constraint init(x) is the same as that of b2: 0. But in (a2)'s postcondition, init(x) *must* be false, but in (b2)'s condition, it's just whatever it was in the postcondition of the preceding statement.
2011-06-22rustc: Convert field access on invalid types from an ICE to a fatal errorBrian Anderson-1/+11
Closes #367
2011-06-22rustc: Don't commit unification changes until unify succeedsBrian Anderson-0/+9
This is so that subsequent reports about type mismatches get the types correct. Issue #516
2011-06-22Fix bug: globbed imports were importing everything visible from the otherPaul Stansifer-0/+14
module, not just everything exported.
2011-06-22rustc: Introduce and parse additional meta_item formsBrian Anderson-0/+6
Examples: #[test], #[link(name = "vers")] Issue #487
2011-06-22test: Enable more testsBrian Anderson-8/+2
2011-06-21Emit a better error message for unbound type parameters in nested functionsTim Chevalier-0/+11
This code was causing a bounds check failure: fn hd[U](&vec[U] v) -> U { fn hd1(&vec[U] w) -> U { ret w.(0); } ret hd1(v); } because in hd1, U was being treated as if it referred to a type parameter of hd1, rather than referring to the lexically enclosing binding for U that's part of hd. I'm actually not sure whether this is a legit program or not. But I wanted to get rid of the bounds check error, so I assumed that program shouldn't compile and made it a proper error message.
2011-06-21Serialize constraints in types (literal arguments still not supported)Tim Chevalier-2/+11
This involved, in part, changing the ast::def type so that a def_fn has a "purity" field. This lets the typechecker determine whether functions defined in other crates are pure. It also required updating some error messages in tests. As a test for cross-crate constrained functions, I added a safe_slice function to std::str (slice(), with one of the asserts replaced with a function precondition) and some test cases (various versions of fn-constraint.rs) that call it. Also, I changed "fn" to "pred" for some of the boolean functions in std::uint.
2011-06-18Typecheck block tail expressions that are fn return valuesBrian Anderson-0/+9
2011-06-17Restructure the "checking" pass in typestateTim Chevalier-0/+30
I noticed that typestate was being lazier than it should be, because it was only checking typestate for statements and top-level expression (that is, the expression in a stmt_expr, but not any subexpressions). So I rewrote the checks in tstate/ck.rs to use walk, which exposed a few bugs in typestate that I fixed. Also added some more test cases for if-check.
2011-06-17rustc: Demand that if conditions have bool typeBrian Anderson-0/+11
Closes #513
2011-06-17rustc: Fail to unify if two ty_vars don't unifyBrian Anderson-0/+9
Closes #500
2011-06-17test: Fix mismatched types in prep for typechecker fixesBrian Anderson-1/+1
Issue #500
2011-06-16Add better error messages for bad attributes in .rc filesBrian Anderson-0/+5
Issue #487
2011-06-16rustc: Fix regressed handling of bad attributesBrian Anderson-0/+10
Issue #487
2011-06-16Write some tests for swap.Michael Sullivan-0/+7
2011-06-15Improve and test failure behavior for malformed attributesBrian Anderson-0/+34
2011-06-15test: Add a compile-fail test for attribute/syntax parsingBrian Anderson-0/+8
I don't currently know how to deal with syntax extensions that appear betweeen an attribute and an item, so this test captures the error that occurs. Issue #487
2011-06-15Refactor data structures representing constraints (again...)Tim Chevalier-2/+2
I added a "resolved" version of the ast::constr type -- ty::constr_def -- that has a def_id field instead of an ann_field. This is more consistent with other types and eliminates some checking. Incidentally, I removed the def_map argument to the top-level function in middle::alias, since the ty::ctxt already has a def_map field.
2011-06-15Implement checking against assignments to immutable obj fieldsMarijn Haverbeke-3/+1
2011-06-15Extend alias analysis to check assignmentsMarijn Haverbeke-9/+3
This is a somewhat odd place to put these checks, but the data tracked by that pass, and the available functions, make it trivial to do such a check there.
2011-06-14Remove some unnecessary xfailsTim Chevalier-45/+8