about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2011-08-12Eliminate autoderef on binops and unary negation.Michael Sullivan-0/+17
Autoderef on binops is basically unused, kind of silly, and complicates typechecking. There were only three instances of it in the compiler and the test drivers, two of which were of the form "*foo = foo + 1", which should be written as "*foo += 1" anyways.
2011-08-12Convert most working tests to ivecsBrian Anderson-17/+17
I tried to pay attention to what was actually being tested so, e.g. when I test was just using a vec as a boxed thing, I converted to boxed ints, etc. Haven't converted the macro tests yet. Not sure what to do there.
2011-08-12Remove last uses of vec::lenBrian Anderson-3/+3
2011-08-12Convert compile-fail/alias-mismatch to ivecsBrian Anderson-2/+2
2011-08-12Remove references to std::vec from compile-fail/cross-crate-glob-collision.rsBrian Anderson-4/+4
2011-08-12Properly typecheck unary minusMarijn Haverbeke-0/+5
Closes #813
2011-08-11rustc: Lowercase "main function not found" errorBrian Anderson-1/+1
2011-08-11Lowercase the "wrong type in main fn" errorBrian Anderson-3/+3
2011-08-11Fix the error-pattern in compile-fail/bad-main.rs. Un-XFAILBrian Anderson-4/+1
This is also tested by compile-fail/main-wrong-type.rs but the type signatures are slightly different, so I guess it's worth holding on to.
2011-08-08Implement typestate checking for move-mode args. Un-XFAIL ↵Graydon Hoare-4/+0
compile-fail/move-arg.rs.
2011-08-08Add new arg-passing mode 'move' denoted with '-T'. Translate as ↵Graydon Hoare-0/+14
pass-by-value, doesn't deinit source yet nor get proper analysis in typestate, alias passes.
2011-08-05Another test for the occurs check, this one from issue 778Tim Chevalier-0/+4
2011-08-05Initialize all constraints to FalseTim Chevalier-0/+17
Previously, typestate was initializing the init constraint for a declared-but-not-initialized variable (like x in "let x;") to False, but other constraints to Don't-know. This led to over-lenient results when a variable was used before declaration (see the included test case). Now, everything gets initialized to False in the prestate/poststate- finding phase, and Don't-know should only be used in pre/postconditions. This aspect of the algorithm really needs formalization (just on paper), but for now, this closes #700
2011-08-04Prohibit assignment to upvars in lambdas. Closes #805.Michael Sullivan-0/+31
2011-08-04Implement the occurs checkTim Chevalier-0/+9
In the writeback phase, the typechecker now checks that it isn't replacing a type variable T with a type that contains T. It also does an occurs check in do_autoderef in order to avoid getting into an infinite chain of derefs. I'm a bit worried that there are more places where the occurs check needs to happen where I'm not doing it now, though. Closes #768
2011-08-03Actually un-xfail the test for put in fns.Michael Sullivan-3/+0
2011-08-03Reject programs that do a put outside of iterators.Michael Sullivan-2/+2
Closes #774.
2011-08-03Do a bunch more typechecking for iters and for each loops.Michael Sullivan-0/+8
Closes #771. Closes #772. Closes #796.
2011-08-03Remove all xfail-stage0 directivesBrian Anderson-80/+0
While it is still technically possible to test stage 0, it is not part of any of the main testing rules and maintaining xfail-stage0 is a chore. Nobody should worry about how tests fare in stage0.
2011-08-02Move ppaux::ty_to_str to new record syntaxMarijn Haverbeke-3/+3
2011-08-01Handle bang functions correctly in typestateTim Chevalier-0/+4
The logic for how the "returns" constraint was handled was always dodgy, for reasons explained in the comments I added to auxiliary::fn_info in this commit. Fixed it by adding distinct "returns" and "diverges" constraints for each function, which are both handled positively (that is: for a ! function, the "diverges" constraint must be true on every exit path; for any other function, the "returns" constraint must be true on every exit path). Closes #779
2011-08-01Add tests for destructuring localsMarijn Haverbeke-0/+11
2011-07-29Disallow overloading a method with one of different type. Closes #703.Lindsey Kuper-7/+3
2011-07-29Remove support for obj dtorsMarijn Haverbeke-20/+0
2011-07-27Have bind support non-alias parametric non-bound arguments.Michael Sullivan-12/+2
This was previously disallowed by the typechecker and not properly handled in trans. I removed the typechecker check (replacing it with a simpler check that spawned functions don't have type params) and fixed trans. Closes #756.
2011-07-27Remove the bind-alias test, since binding to aliases is fine.Michael Sullivan-9/+0
2011-07-27Fix damage done by the pretty-printerMarijn Haverbeke-122/+165
2011-07-27Reformat for new syntaxMarijn Haverbeke-1285/+644
2011-07-26Add a bunch of tests for blocks.Michael Sullivan-0/+37
2011-07-26Remove uses of tuples from the test suiteMarijn Haverbeke-14/+10
2011-07-25Add a pass that checks for unreachable alt armsMarijn Haverbeke-0/+10
2011-07-24The Big Test Suite OverhaulBrian Anderson-6/+14
This replaces the make-based test runner with a set of Rust-based test runners. I believe that all existing functionality has been preserved. The primary objective is to dogfood the Rust test framework. A few main things happen here: 1) The run-pass/lib-* tests are all moved into src/test/stdtest. This is a standalone test crate intended for all standard library tests. It compiles to build/test/stdtest.stageN. 2) rustc now compiles into yet another build artifact, this one a test runner that runs any tests contained directly in the rustc crate. This allows much more fine-grained unit testing of the compiler. It compiles to build/test/rustctest.stageN. 3) There is a new custom test runner crate at src/test/compiletest that reproduces all the functionality for running the compile-fail, run-fail, run-pass and bench tests while integrating with Rust's test framework. It compiles to build/test/compiletest.stageN. 4) The build rules have been completely changed to use the new test runners, while also being less redundant, following the example of the recent stageN.mk rewrite. It adds two new features to the cfail/rfail/rpass/bench tests: 1) Tests can specify multiple 'error-pattern' directives which must be satisfied in order. 2) Tests can specify a 'compile-flags' directive which will make the test runner provide additional command line arguments to rustc. There are some downsides, the primary being that Rust has to be functioning pretty well just to run _any_ tests, which I imagine will be the source of some frustration when the entire test suite breaks. Will also cause some headaches during porting. Not having individual make rules, each rpass, etc test no longer remembers between runs whether it completed successfully. As a result, it's not possible to incrementally fix multiple tests by just running 'make check', fixing a test, and repeating without re-running all the tests contained in the test runner. Instead you can filter just the tests you want to run by using the TESTNAME environment variable. This also dispenses with the ability to run stage0 tests, but they tended to be broken more often than not anyway.
2011-07-22Implement Macro By Example.Paul Stansifer-1/+1
2011-07-22Add xfail-stage3 directives to testsBrian Anderson-0/+9
The new test runners run stage 3
2011-07-19Beginnings of support for constrained typesTim Chevalier-0/+25
Programs with constrained types now parse and typecheck, but typestate doesn't check them specially, so the one relevant test case so far is XFAILed. Also rewrote all of the constraint-related data structures in the process (again), for some reason. I got rid of a superfluous data structure in the context that was mapping front-end constraints to resolved constraints, instead handling constraints in the same way in which everything else gets resolved.
2011-07-18Sane error message for self-call in non-obj context. Closes #707.Lindsey Kuper-0/+14
2011-07-18Fix native-type-mismatch test on win32Brian Anderson-1/+1
2011-07-15More tests for anonymous objects. Issues #702, #703.Lindsey Kuper-0/+29
2011-07-14XFAIL some tests in stage 0Brian Anderson-0/+2
2011-07-13Make resolve and the typechecker check for a main fn of theTim Chevalier-0/+12
correct type This means if a non-library program leaves out the main program, the error gets caught earlier than link. Closes #626.
2011-07-13Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.Graydon Hoare-10/+10
2011-07-13Add test case from issue #675. The previous fix actually fixes this too.Tim Chevalier-0/+5
2011-07-12Make resolve check for type-variable name-shadowingTim Chevalier-5/+8
Capturing a type argument in the enclosing scope should be an error -- this commit implements that check in resolve, avoiding a potential assertion failure in trans. Closes #648.
2011-07-12Change typestate to use visit instead of walkTim Chevalier-0/+8
Typestate was failing to check some code because if it saw an item, it would quit immediately. This was to avoid checking nested items in the same context as the lexically enclosing item, but it was having the wrong effect: not checking the code after the item at all. Fixed by switching to visit and skipping over items in a proper nested fashion. Closes #668.
2011-07-11Move macro expansion to a separate phase, change macro syntax, and add ↵Paul Stansifer-3/+3
parse_sess to session.
2011-07-11In typeck, check for dynamically sized by-value arguments to thunksTim Chevalier-0/+28
A check in trans didn't have a corresponding check in typeck, causing some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this commit) to fail with an assertion failure in trans instead of a type error. Fixed it. In short, arguments that are future thunk arguments (any spawn arguments, and _ arguments in bind) need to either not contain type params or type vars, or be by-reference. Closes #665.
2011-07-11Implement record patternsMarijn Haverbeke-0/+14
Closes #469.
2011-07-11Implement or-patterns in case clausesMarijn Haverbeke-0/+12
You can now say expr_move(?dst, ?src) | expr_assign(?dst, ?src) { ... } to match both expr_move and expr_assign. The names, types, and number of bound names have to match in all the patterns. Closes #449.
2011-07-08Tests for constraint propagationTim Chevalier-0/+21
2011-07-08Improve the error message for import glob collisions. Closes #482Brian Anderson-0/+14
Instead of noting where the imported things were defined, note where they were imported. This is more useful and avoids issue #482.