Tim Chevalier
52f2a9a1c9
Test case to make sure typestate checks the body of class constructors
2012-03-28 10:38:57 -07:00
Tim Chevalier
edb747ceed
Enforce mutability declarations in classes; correct shapes for classes
...
1. Enforce mutability declarations on class fields. Don't allow any
mutation of class fields not declared as mutable (except inside the
constructor).
2. Handle classes correctly in shape (treat classes like records).
2012-03-27 22:11:58 -07:00
Graydon Hoare
6e6798c4e1
Bulk-edit mutable -> mut.
2012-03-26 18:35:18 -07:00
Tim Chevalier
11610f9ca1
In typeck, don't call ty::store_iface_methods on private methods
...
This was resulting in a different error message depending on whether
the private method you were trying to call was in the same crate
or a different one.
2012-03-26 10:46:37 -07:00
Niko Matsakis
21111660ca
Improve type inference to compute LUB/GLB
2012-03-26 10:34:58 -07:00
Tim Chevalier
2112c391cd
Remove stray comment
2012-03-26 10:04:46 -07:00
Tim Chevalier
c282810ab0
Enforce privacy declarations for class fields and methods
2012-03-26 10:00:33 -07:00
Marijn Haverbeke
87e097a853
Disallow ret inside of block functions
...
Also adds proper checking for cont/break being inside a loop.
Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Niko Matsakis
1d7d5c16b3
correct more broken tests
2012-03-24 22:15:34 -07:00
Niko Matsakis
bf9d714d46
Avoid unifying vars when possible; handle bot (more) correctly
2012-03-24 21:38:43 -07:00
Niko Matsakis
ee5d0f5e3f
new test which features conflicting variance requirements
2012-03-24 21:38:42 -07:00
Patrick Walton
8bef2716fe
test: Add a simple test for dangling pointers
2012-03-24 19:00:08 -07:00
Niko Matsakis
042c532a08
Implement new inference algorithm.
2012-03-23 21:47:28 -07:00
Niko Matsakis
cfcbec3cc3
Implement an initial version of placement new.
2012-03-20 20:39:40 -07:00
Niko Matsakis
e399ddbf17
allow binding of fn~, make result fn@. fixes 1899.
2012-03-16 17:48:53 -04:00
Marijn Haverbeke
35fc4a4291
Check kind bounds when calling methods
...
Closes #1915
2012-03-16 17:05:29 +01:00
Brian Anderson
e1b14f6d5b
test: Fix name of bitv type
2012-03-15 14:54:41 -07:00
Marijn Haverbeke
3ab9978b9b
Remove support for dynamically-sized types from translation code
2012-03-15 15:08:31 +01:00
Brian Anderson
3864d6d845
std: Rename the hashmap constructors to conform to new standards
...
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Brian Anderson
b968c8e6cd
Name types after their modules instead of 't'
2012-03-13 15:14:17 -07:00
Graydon Hoare
6f5853f5a1
Libc/os/run/rand/io reorganization. Close #1373 . Close #1638 .
...
- Move io, run and rand to core.
- Remove incorrect ctypes module (use libc).
- Remove os-specific modules for os and fs.
- Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Tim Chevalier
664d71f1f0
Improve a typechecker error message (wrong type for main())
...
As per #1903 , state what type is expected for main().
Closes #1903
2012-03-11 20:55:19 -07:00
Tim Chevalier
813c41362b
A few tests for infinite loops
2012-03-11 20:17:27 -07:00
Tim Chevalier
9838a7ec54
Tweak some test cases and add a few new ones
2012-03-10 20:38:03 -08:00
Tim Chevalier
98260a2a22
Handle infinite-loop poststate correctly in typestate
...
If control passes an infinite loop (that doesn't have non-local
exits), then everything is true.
2012-03-10 20:15:27 -08:00
Tim Chevalier
321fd80219
Add an infinite loop construct
...
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Patrick Walton
c9375fed8d
stdlib: Stop incurring vtable dispatch costs when hashmaps are used
...
This required changing almost all users of hashmaps to import the hashmap interface first.
The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980
Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
...
This reverts commit f0250a23d3
.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3
stdlib: Stop incurring vtable dispatch costs when hashmaps are used
...
This required changing almost all users of hashmaps to import the hashmap interface first.
The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Tim Chevalier
90ac69904f
Improve a type error message (avoid the word 'non-dereferenceable')
2012-03-07 14:14:34 -08:00
Brian Anderson
0ee96de4ee
rustc: Lower case error messages
2012-03-05 17:05:20 -08:00
Niko Matsakis
8820d4485b
print type arguments when pretty-printing all nominal types
2012-03-05 16:47:52 -08:00
Niko Matsakis
12c68bcd6d
make sure we do not bind unique closures (or blocks, for that matter)
2012-03-02 06:47:25 -08:00
Tim Chevalier
c28c258f91
Disallow type parameters in the main() function
...
Closes #1900
2012-02-25 11:06:01 -08:00
Marijn Haverbeke
780f8277f4
Finish cleanup of core::str
...
Closes #1849
2012-02-23 17:00:19 +01:00
Brian Anderson
27ab663845
rustc: Don't ignore attributes inside empty mods. Closes #1655
2012-02-22 21:47:23 -08:00
Brian Anderson
ae23ee28e2
test: Add a test for #1697
2012-02-22 21:14:27 -08:00
Tim Chevalier
4acfcd8c2f
Improve error message for use of a non-pure-fn in a pred
...
Closes #1883
2012-02-22 10:59:52 -08:00
Marijn Haverbeke
ad03761a97
Remove preconditions from libraries
...
Closes #1805
2012-02-22 11:47:47 +01:00
Graydon Hoare
ef6f628589
Refactor view_path to parse (but not yet process) export globs, unify code paths.
2012-02-17 23:05:20 -08:00
Marijn Haverbeke
e62ddf4898
More rigorous reuse of cleanup sequences
...
In both landing pads and break/cont/ret unwinding.
Closes #300
2012-02-16 16:37:33 +01:00
Marijn Haverbeke
67cc89f38d
Rewrite exhaustiveness checker
...
Issue #352
Closes #1720
The old checker would happily accept things like 'alt x { @some(a) { a } }'.
It now properly descends into patterns, checks exhaustiveness of booleans,
and complains when number/string patterns aren't exhaustive.
2012-02-15 15:47:42 +01:00
Marijn Haverbeke
16e5760564
Fix bug in safe-reference checker
...
At some point, a refactor broke the code that handled local declarations
to no longer descend into the initializer expressions.
Closes #1846
2012-02-15 11:53:32 +01:00
Kevin Atkinson
d6d7134c37
When parsing a source string, fail when the entire string is not parsed.
...
(For now only fail when parse_from_source_str is used to avoid
possible compatibility problems; parse_expr_from_source_str still
does not check.)
2012-02-14 19:37:33 -08:00
Kevin Atkinson
0e44133e7c
Do a better job of reporting source location for files (i.e. filemap)
...
that are really a substr of another file.
2012-02-14 19:37:33 -08:00
Brian Anderson
0a503228f6
rustc: Typecheck crust functions as *u8
2012-02-14 11:24:09 -08:00
Niko Matsakis
520c3f5f79
correct error message and add to test
2012-02-13 07:33:16 -08:00
Niko Matsakis
4eb52f69a9
do not fail if iface/impl method have different number of parameters
2012-02-13 06:50:58 -08:00
Niko Matsakis
a7641e99e8
remove leading ::, new tests
2012-02-13 06:50:58 -08:00
Brian Anderson
005a3efb8b
test: Fix cros-crate-glob-collision
2012-02-11 18:20:02 -08:00
Niko Matsakis
3f15a28b16
correct fully qualified type names to include the crate; add tests (take 2)
...
This reverts commit fc023d91c7
.
2012-02-11 14:09:52 -08:00
Niko Matsakis
fc023d91c7
Revert prior commit until I have time to track down the valgrind error
...
This reverts commit 2ec3a0b608
.
2012-02-11 09:49:02 -08:00
Niko Matsakis
2ec3a0b608
correct fully qualified type names to include the crate; add tests
...
fixes #1745
2012-02-10 21:53:17 -08:00
Brian Anderson
17110fb28b
test: Add tests for #1802
2012-02-10 15:43:35 -08:00
Marijn Haverbeke
7f1ea3ef6a
Don't allow binding patterns to bind keywords
...
Closes #1586
2012-02-10 15:54:47 +01:00
Marijn Haverbeke
74d4e2a32e
Add compile-fail tests for interfaces/impls
...
Closes #1475
2012-02-10 13:31:33 +01:00
Brian Anderson
80cd6aa96e
test: Update and un-xfail compile-fail/tag-that-dare-not...
2012-02-05 18:06:54 -08:00
Niko Matsakis
9f0239ce9c
add a test where mode inference ought to fail
2012-02-05 13:59:09 -08:00
Kevin Atkinson
5ef53382ae
Add support for parsing quasi-quotes, doesn't do anything useful yet.
2012-02-03 20:23:49 -07:00
Marijn Haverbeke
c976b7c623
Fix tests for str::le patch
2012-02-03 14:32:23 +01:00
Kevin Cantu
8f367ebfeb
Rename (again) str::unsafe::slice -> str::unsafe::slice_bytes and
...
str::unsafe::safe_slice -> str::unsafe::slice_bytes_safe_range
2012-02-01 21:56:53 -08:00
Kevin Cantu
c71667d9d2
Propagating unsafe::slice 4
2012-02-01 21:56:53 -08:00
Marijn Haverbeke
856a544d0c
Remove native types from stdlib
2012-02-01 12:23:13 +01:00
Tim Chevalier
e5d095d67e
Change option::t to option
...
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.
The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00
Tim Chevalier
fba35e1a3c
Require alts to be exhaustive
...
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
2012-01-31 10:08:24 -08:00
Brian Anderson
53dbde6cc2
rustc: Make 'attempted access of field' error non-fatal
2012-01-27 16:58:27 -08:00
Marijn Haverbeke
e48bf6f3f4
Make occurs check in ty::fixup_vars more reliable
...
It wouldn't detect cycles that went through several type vars before.
Closes #1464
2012-01-27 18:58:52 +01:00
Marijn Haverbeke
dc55c06aa3
Properly check enum types for recursion
...
Closes #742
2012-01-27 16:03:43 +01:00
Brian Anderson
28fbb19664
rustc: Switch the --no-core switch to a #[no_core] attribute
2012-01-26 16:43:33 -08:00
Brian Anderson
5610205363
rustc: Move core injection to its own module
2012-01-26 16:23:48 -08:00
Marijn Haverbeke
888262b337
Allow operator overloading of the indexing operator
...
The method `op_index` (which takes a single argument) is used for
this.
Issue #1520
2012-01-26 15:23:11 +01:00
Marijn Haverbeke
87b064b249
First stab at operator overloading
...
When no built-in interpretation is found for one of the operators
mentioned below, the typechecker will try to turn it into a method
call with the name written next to it. For binary operators, the
method will be called on the LHS with the RHS as only parameter.
Binary:
+ op_add
- op_sub
* op_mul
/ op_div
% op_rem
& op_and
| op_or
^ op_xor
<< op_shift_left
>> op_shift_right
>>> op_ashift_right
Unary:
- op_neg
! op_not
Overloading of the indexing ([]) operator isn't finished yet.
Issue #1520
2012-01-26 14:25:06 +01:00
Niko Matsakis
5e13d19cc0
s/block()/fn()/g
2012-01-23 19:06:33 -08:00
Brian Anderson
7d5d1a311e
test: Add no-reformat directive to compile-fail/issue-1362
2012-01-23 17:37:15 -08:00
Kevin Atkinson
664d9cc86f
Add regression test for issue #1362 .
...
Although its not really needed. Without that fix, reported spans will
likely be bogus if the error is within the first couple of lines
(probable around 5) of that file. Thus, many of the compile-fail
tests will fail due to incorrect location.
2012-01-23 17:37:15 -08:00
Kevin Atkinson
5e60facf78
Add regresion tests for issue #1448 and #1387 .
2012-01-23 17:37:15 -08:00
Tim Chevalier
6db688e893
Check that the names mentioned in tag exports are actually types (or variants)
...
Check that in export foo{}, foo is an enum type, and that in export
foo{bar, quux}, foo is an enum type and bar and quux are variants belonging
to foo.
2012-01-23 15:48:08 -08:00
Tim Chevalier
9dc59e1506
Export all enum variants by default; new syntax for selectively exporting variants
...
See issue 1426 for details. Now, the semantics of "export t;" where t is a tag are
to export all of t's variants as well. "export t{};" exports t but not its
variants, while "export t{a, b, c};" exports only variants a, b, c of t.
To do:
- documentation
- there's currently no checking that a, b, c are actually variants of t in the
above example
- there's also no checking that t is an enum type, in the second two examples above
- change the modules listed in issue 1426 that should have the old export
semantics to use the t{} syntax
I deleted the test export-no-tag-variants since we're doing the opposite now,
and other tests cover the same behavior.
2012-01-23 15:48:08 -08:00
Tim Chevalier
ba5cc236f7
WIP on issue 1426 (exporting all tags)
...
Support Lenny222's proposed syntax for exporting a tag without
its variants, or selected tags from a variant, in the AST and parser.
No support further down the line yet. Tests are xfailed.
2012-01-20 19:48:33 -08:00
Tim Chevalier
e36df0f6c8
Handle fail after return correctly in typestate
...
Previously, typestate would conclude that this function was
correctly diverging:
fn f() -> ! { ret; fail; }
even though it always returns to the caller. It wasn't handling the
i_diverge and i_return bits correctly in the fail case. Fixed it.
Closes #897
2012-01-20 17:26:31 -08:00
Graydon Hoare
7b1a8f0a91
Additional ; to , changes, disable "tag" and ";" in parser. Close #1430 . Close #1428 .
2012-01-19 19:29:21 -08:00
Patrick Walton
59ebe6af18
rustc: Make the pretty printer output commas after enum variants. Update all tests accordingly.
2012-01-19 18:41:06 -08:00
Kevin Atkinson
d388daa996
Remove incorrect comments from a few test cases.
2012-01-19 17:31:36 -07:00
Patrick Walton
d97783e3e5
test: "tag" -> "enum" in compile-fail
2012-01-19 16:01:47 -08:00
Patrick Walton
1731f5d709
test: Fix error patterns in name-clash-nullary
2012-01-19 14:47:43 -08:00
Niko Matsakis
882bea5b6d
Rename fn*() to fn() as originally planned.
2012-01-19 07:11:50 -08:00
Haitao Li
327a15d58c
rustc: Add a usage pass to collect one-off analyses
...
This patch starts from move the analysis which checkes of probably
incorrectly usage of `int|uint` in native fn.
Issue #1543
2012-01-19 17:27:44 +08:00
Tim Chevalier
5b028f527f
Remove support for the '.' after a nullary tag in a pattern
...
(Commit also includes lots of changes to remove '.'s that a git
merge messed up, or else it was monkeys.)
2012-01-19 01:04:59 -08:00
Patrick Walton
5ac57d1891
test: Don't test that tags with zero variants are supported
2012-01-18 12:43:01 -08:00
Haitao Li
f03eb96f39
rustc: Warn when int or uint is used in a native type decl
...
Issue #1403
2012-01-19 02:10:36 +08:00
Marijn Haverbeke
1375b31c1c
Store type names in crate metadata
...
Improves type error messages referring to external types.
Issue #1507
2012-01-16 12:08:00 +01:00
Marijn Haverbeke
c2fe7b6398
When pretty-printing fn types, leave off arg modes when they are the default
...
This reduces ++/&& spam in the output to a bare minimum.
Issue #1507
2012-01-16 12:08:00 +01:00
Kevin Atkinson
e1c50c4410
Don't evaluate discriminator value constants when parsing.
...
Remove disr_val from ast::variant_ and always use ty::variant_info
when the value is needed. Move what was done during parsing into
other passes, primary typeck.rs. This move also correctly type checks
the disr. value expression; thus, fixing rustc --pretty=typed when
disr. values are used.
2012-01-16 11:19:33 +01:00
Brian Anderson
3466c9b4be
rustc: Parse fn inner attributes. Closes #1506
2012-01-15 17:48:58 -08:00
Niko Matsakis
8685a1f7c4
distinguish "any closure" and "stack closure" (block)
2012-01-13 09:31:40 -08:00
Niko Matsakis
3f3bfeec27
make "native fn" the type for bare functions, remove fn exprs
2012-01-13 06:27:35 -08:00
Niko Matsakis
455f8b0d45
deprecate fn exprs and the fn() type, preferring fn@ and native fn
2012-01-13 06:27:34 -08:00
Marijn Haverbeke
d2be5b6c7a
Remove tests for objs, adjust tests that use objs
2012-01-13 11:52:13 +01:00
Kevin Atkinson
44352df57c
Cleanups to previous commits for issue #1393 .
2012-01-12 09:55:48 +01:00
Brian Anderson
35b27aa172
test: Add a test that empty records don't parse
...
Closes #1200
2012-01-11 19:45:18 -08:00