aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests
Commit message (Collapse)AuthorAgeFilesLines
* internal: start new diagnostics APIAleksey Kladov2021-06-131-14/+0
| | | | | | | | | | | | | | | | | | At the moment, this moves only a single diagnostic, but the idea is reafactor the rest to use the same pattern. We are going to have a single file per diagnostic. This file will define diagnostics code, rendering range and fixes, if any. It'll also have all of the tests. This is similar to how we deal with assists. After we refactor all diagnostics to follow this pattern, we'll probably move them to a new `ide_diagnostics` crate. Not that we intentionally want to test all diagnostics on this layer, despite the fact that they are generally emitted in the guts on the compiler. Diagnostics care to much about the end presentation details/fixes to be worth-while "unit" testing. So, we'll unit-test only the primary output of compilation process (types and name res tables), and will use integrated UI tests for diagnostics.
* Implement per-edition preludesJonas Schievink2021-06-011-17/+15
|
* Test that `ItemTree` works as intendedJonas Schievink2021-05-271-1/+73
|
* internal: move diagnostics to hirAleksey Kladov2021-05-251-42/+15
| | | | | | | | | | | | | | | | | | | | | | | The idea here is to eventually get rid of `dyn Diagnostic` and `DiagnosticSink` infrastructure altogether, and just have a `enum hir::Diagnostic` instead. The problem with `dyn Diagnostic` is that it is defined in the lowest level of the stack (hir_expand), but is used by the highest level (ide). As a first step, we free hir_expand and hir_def from `dyn Diagnostic` and kick the can up to `hir_ty`, as an intermediate state. The plan is then to move DiagnosticSink similarly to the hir crate, and, as final third step, remove its usage from the ide. One currently unsolved problem is testing. You can notice that the test which checks precise diagnostic ranges, unresolved_import_in_use_tree, was moved to the ide layer. Logically, only IDE should have the infra to render a specific range. At the same time, the range is determined with the data produced in hir_def and hir crates, so this layering is rather unfortunate. Working on hir_def shouldn't require compiling `ide` for testing.
* Work around non-unique AttrIdsJonas Schievink2021-05-221-1/+17
|
* Don't lower extern block in the ItemTreeJonas Schievink2021-05-211-0/+36
|
* Support `#[register_attr]` and `#[register_tool]`Jonas Schievink2021-05-201-0/+17
|
* Refactor name resolution to resolve derive helpersJonas Schievink2021-05-201-0/+22
|
* Fix unresolved attribute fallback againJonas Schievink2021-05-191-0/+29
|
* Fix derive collection after unresolved attribute fallbackJonas Schievink2021-05-191-1/+21
|
* Test that none of the macros are reparsedJonas Schievink2021-05-091-0/+6
|
* Update crates/hir_def/src/nameres/tests/incremental.rsAleksey Kladov2021-05-061-1/+1
| | | Co-authored-by: Jonas Schievink <[email protected]>
* internal: add failing incremental testAleksey Kladov2021-05-061-0/+52
|
* Include path in `unresolved-macro-call` diagnosticJonas Schievink2021-04-161-2/+2
|
* Update `OUT_DIR` diagnostic to match settingJonas Schievink2021-04-071-1/+1
|
* Allow include! an empty content fileEdwin Cheng2021-04-031-0/+20
|
* Remove unused test fixturesEdwin Cheng2021-03-281-4/+0
|
* Basic Support Macro 2.0Edwin Cheng2021-03-271-0/+22
|
* Expand legacy-scoped macro during collectionJonas Schievink2021-03-211-0/+21
|
* Fix handling of `#![cfg]` in outline module fileJonas Schievink2021-03-191-0/+19
|
* Add testJonas Schievink2021-03-181-0/+26
|
* Improve diagnostic when including nonexistent fileJonas Schievink2021-03-171-1/+1
|
* Use first early expansion error during nameresJonas Schievink2021-03-171-0/+17
|
* Merge #7970bors[bot]2021-03-151-0/+45
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7970: Fix incorrect diagnostics for failing built in macros r=jonas-schievink a=brandondong **Reproduction:** 1. Use a built in macro in such a way that rust-analyzer fails to expand it. For example: **lib.rs** ``` include!("<valid file but without a .rs extension so it is not indexed by rust-analyzer>"); ``` 2. rust-analyzer highlights the macro call and says the macro itself cannot be resolved even though include! is in the standard library (unresolved-macro-call diagnostic). 3. No macro-error diagnostic is raised. **Root cause for incorrect unresolved-macro-call diagnostic:** 1. collector:collect_macro_call is able to resolve include! in legacy scope but the expansion fails. Therefore, it's pushed into unexpanded_macros to be retried with module scope. 2. include! fails at the resolution step in collector:resolve_macros now that it's using module scope. Therefore, it's retained in unexpanded_macros. 3. Finally, collector:finish tries resolving the remaining unexpanded macros but only with module scope. include! again fails at the resolution step so a diagnostic is created. **Root cause for missing macro-error diagnostic:** 1. In collector:resolve_macros, directive.legacy is None since eager expansion failed in collector:collect_macro_call. The macro_call_as_call_id fails to resolve since we're retrying in module scope. Therefore, collect_macro_expansion is not called for the macro and no macro-error diagnostic is generated. **Fix:** - In collector:collect_macro_call, do not add failing built-in macros to the unexpanded_macros list and immediately raise the macro-error diagnostic. This is in contrast to lazy macros which are resolved in collector::resolve_macros and later expanded in collect_macro_expansion where a macro-error diagnostic may be raised. Co-authored-by: Brandon <[email protected]> Co-authored-by: brandondong <[email protected]>
| * Fix incorrect diagnositics for failing built in eager macrosBrandon2021-03-141-0/+45
| |
* | Extend cfg_attr testJonas Schievink2021-03-131-0/+3
|/
* Use upstream cov-markLaurențiu Nicola2021-03-084-14/+13
|
* Use body lowering for block_def_map testsJonas Schievink2021-02-031-186/+0
| | | | Removes the hacky and buggy custom lowering code
* Revert "Use block_def_map in body lowering"Jonas Schievink2021-02-021-0/+186
|
* Use body lowering for block_def_map testsJonas Schievink2021-02-011-186/+0
| | | | Removes the hacky and buggy custom lowering code
* Honor #![macro_use] in mod source filesLukas Wirth2021-01-311-0/+14
|
* block_def_map: add a few macro testsJonas Schievink2021-01-281-0/+63
|
* Traverse parent DefMap for `super` pathsJonas Schievink2021-01-251-0/+26
|
* Add mark::check! and mark::hit!kazatsuyu2021-01-221-0/+1
|
* Fix error when using "extern crate self as"kazatsuyu2021-01-221-0/+15
|
* Remove unnecessary annotations from testsJonas Schievink2021-01-211-4/+0
|
* Add test for nameres in nested blocksJonas Schievink2021-01-211-0/+29
|
* Add test that merges inner and outer namesJonas Schievink2021-01-211-0/+25
|
* Add name resolution query for block expressionsJonas Schievink2021-01-211-0/+47
|
* Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-071-2/+2
|
* Fixed old failed test due to new fixesEdwin Cheng2020-12-281-2/+2
|
* fixture -> ra_fixtureJonas Schievink2020-12-191-2/+2
|
* Test paths to derive macrosJonas Schievink2020-12-191-2/+2
|
* Hit a markJonas Schievink2020-12-181-0/+2
|
* Add testJonas Schievink2020-12-181-0/+16
|
* Make macro def krate mandatoryJonas Schievink2020-12-151-1/+30
| | | | Refactors builtin derive support to go through proper name resolution
* Escape string literals in Attr::from_srcLukas Wirth2020-12-081-1/+1
|
* Don't discard PathKind::Abs information in lower_use::convert_pathLukas Wirth2020-12-021-0/+21
|
* Test def map invalidation with #[cfg] below changeJonas Schievink2020-11-261-0/+6
|
* Don't stack overflow on circular modulesAleksey Kladov2020-11-041-0/+27
| | | | closes #6453