Aleksey Kladov
586acef528
Simplify ADT fields
2019-11-24 22:44:24 +03:00
Aleksey Kladov
fe119fef27
Hide data from public API
2019-11-22 18:51:53 +03:00
Aleksey Kladov
d4f4ae0dd8
Move const&static date to hir_def
2019-11-22 18:46:39 +03:00
Aleksey Kladov
78f3b0627c
Move FunctionData to hir_def
2019-11-22 17:18:04 +03:00
Aleksey Kladov
4daf931111
Remove old hir::generics module
2019-11-21 16:23:02 +03:00
Aleksey Kladov
6d64798a23
Move resolver to hir_def
2019-11-21 15:39:09 +03:00
Aleksey Kladov
00684d708b
Decouple
2019-11-21 15:24:51 +03:00
Aleksey Kladov
061e6c77b5
Decouple
2019-11-21 14:13:49 +03:00
Aleksey Kladov
0102fb4133
Decouple Resolver
2019-11-21 13:25:03 +03:00
Aleksey Kladov
6241cf9a59
Add HasResolver trait
2019-11-20 22:22:32 +03:00
Aleksey Kladov
7c275a7ed2
Remove hir/adt.rs
2019-11-20 21:34:12 +03:00
Aleksey Kladov
0e771915fa
Allow non-path default type parameters
2019-11-20 11:46:44 +03:00
Aleksey Kladov
70dd70b1fc
Reduce duplication between uncertain floats & ints
2019-11-13 09:56:33 +03:00
Aleksey Kladov
d09e5a3d9e
Move definition of exprs to hir_def
2019-11-12 15:09:25 +03:00
Aleksey Kladov
f5e1b0f97c
Minor refactoring
2019-11-12 12:07:47 +03:00
Aleksey Kladov
6294fd5ec9
Unfork struct and union ids
2019-11-09 15:34:00 +03:00
Aleksey Kladov
739babc391
Move Namespace enum closer to usage
2019-11-04 23:02:35 +03:00
Aleksey Kladov
f0eb9cc6e6
Remove last traces of nameres from hir
2019-11-03 23:49:44 +03:00
Aleksey Kladov
09f9733ca6
move struct & enum data to hir_def
2019-10-31 16:40:36 +03:00
Aleksey Kladov
b20d37cb49
move builtin types to hir_def
2019-10-31 10:51:54 +03:00
Aleksey Kladov
e5300ad3ba
remove forward pointer for type_ref
2019-10-30 17:43:14 +03:00
Aleksey Kladov
e564334320
remove forward pointer to Path
2019-10-30 17:43:14 +03:00
Shotaro Yamada
3a55b5bf01
make_mut_slice
2019-10-14 19:50:12 +09:00
Shotaro Yamada
b462eb96b8
import make_mut_arc_slice
2019-10-14 17:21:38 +09:00
Shotaro Yamada
965ca0d271
.collect()
directly into Arc<[T]>
2019-10-14 14:25:05 +09:00
Shotaro Yamada
f8d4cdc170
Avoid cloning Arc<[T]>
into a vec if possible
2019-10-14 14:25:05 +09:00
ice1000
6bad638928
Support inferring Self
type in enum definitions
...
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
2019-10-07 19:40:14 -04:00
Florian Diebold
daaf46177e
Add SubstsBuilder
...
+ further refactoring.
2019-09-26 23:03:39 +02:00
Florian Diebold
c35ef5013c
Resolve trait associated items
...
E.g. `Default::default` or `<Foo as Default>::default`.
2019-09-25 21:41:17 +02:00
Florian Diebold
18bf278c25
Handle associated type shorthand (T::Item
)
...
This is only allowed for generic parameters (including `Self` in traits), and
special care needs to be taken to not run into cycles while resolving it,
because we use the where clauses of the generic parameter to find candidates for
the trait containing the associated type, but the where clauses may themselves
contain instances of short-hand associated types.
In some cases this is even fine, e.g. we might have `T: Trait<U::Item>, U:
Iterator`. If there is a cycle, we'll currently panic, which isn't great, but
better than overflowing the stack...
2019-09-22 20:02:32 +02:00
Florian Diebold
c2f9558e1a
Remove assoc type selection code for now to fix crashes
2019-09-17 23:11:20 +02:00
Florian Diebold
53a932509d
Small review improvements
2019-09-17 19:47:45 +02:00
Florian Diebold
fe1dfd2b20
Refactor some more
...
Type-relative paths (`<T>::foo`) also need to work in type context, for example
`<T>::Item` is legal. So rather than returning the type ref from the resolver
function, just check it before.
2019-09-17 19:47:45 +02:00
Florian Diebold
406280e52f
Refactor associated item resolution more
...
When resolving an associated item in value namespace, use the `Ty` lowering code
for the segments before the last instead of replicating it.
2019-09-17 19:47:45 +02:00
Florian Diebold
913ab1ec0a
Resolve assoc types on type parameters
...
E.g. `fn foo<T: Iterator>() -> T::Item`. It seems that rustc does this only for
type parameters and only based on their bounds, so we also only consider traits
from bounds.
2019-09-17 19:47:45 +02:00
Florian Diebold
dc935be1b5
Support bare Trait
without dyn
2019-09-14 10:20:41 +02:00
Aleksey Kladov
51e2d76b98
Specify desirable namespace when calling resolve
...
That way, we are able to get rid of a number of unreachable statements
2019-09-13 16:24:10 +03:00
Aleksey Kladov
114a1b878e
rename AdtDef -> Adt
2019-09-13 00:34:52 +03:00
Aleksey Kladov
bcf30d389c
generalize impl_froms to nested enums
2019-09-13 00:31:04 +03:00
Aleksey Kladov
45117c6388
make various enums "inherit" from AdtDef
2019-09-13 00:10:16 +03:00
Aleksey Kladov
63e1e63a91
start cleaning up the resolution
...
Nameres related types, like `PerNs<Resolution>`, can represent
unreasonable situations, like a local in a type namespace. We should
clean this up, by requiring that call-site specifies the kind of
resolution it expects.
2019-09-12 21:34:22 +03:00
Aleksey Kladov
6021a2a83a
cleanup hir db imports
2019-09-08 09:55:12 +03:00
Florian Diebold
60bdb66ef2
Lower bounds on trait definition, and resolve assoc types from super traits
2019-09-07 14:31:43 +02:00
Florian Diebold
b8c1e402fa
Make type walking infrastructure a bit nicer
...
If/when we switch to using Chalk's Ty, we'll need to replace this by its `Fold`
trait, but I didn't want to import the whole thing just yet.
2019-09-03 14:00:35 +02:00
Florian Diebold
741e350d4b
Add support for associated type bindings (where Trait<Type = X>
)
2019-09-03 14:00:35 +02:00
Florian Diebold
16a7d8cc85
Add impl Trait
and dyn Trait
types
...
- refactor bounds handling in the AST a bit
- add HIR for bounds
- add `Ty::Dyn` and `Ty::Opaque` variants and lower `dyn Trait` / `impl Trait`
syntax to them
2019-08-22 19:33:00 +02:00
Florian Diebold
6265497523
Normalize associated types during inference
2019-08-12 21:43:00 +02:00
Florian Diebold
22724f37f3
Lower fully qualified associated type paths
...
I.e. `<T as Trait>::Foo`.
2019-08-12 21:43:00 +02:00
Florian Diebold
0a20770f46
Some renamings for clarity
2019-07-14 18:22:47 +02:00
Florian Diebold
b1b12072ed
Start handling environment in trait resolution
...
I.e. if we are inside a function with some where clauses, we assume these where
clauses hold.
2019-07-08 21:20:17 +02:00