Skip to content

Conversation

@flodiebold
Copy link
Member

Notable changes:

  • unify check_types and check_mismatches into check, which supports both kinds of annotations (check_types still exists because I didn't want to change all the annotations, but uses the same implementation)
  • because of that, check_types now fails on any type mismatches; also annotations always have to hit the exact range
  • there's also check_no_mismatches for when we explicitly just want to check that there are no type mismatches without giving any annotations (check will fail without annotations)
  • test annotations can now be overlapping (they point to the nearest line that has actual code in that range):
// ^^^^ annotation
//    ^^^^^^^^^ another annotation

@flodiebold
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Jun 20, 2021
9346: Refactor / clean up hir_ty tests r=flodiebold a=flodiebold

Notable changes:
 - unify `check_types` and `check_mismatches` into `check`, which supports both kinds of annotations (`check_types` still exists because I didn't want to change all the annotations, but uses the same implementation)
 - because of that, `check_types` now fails on any type mismatches; also annotations always have to hit the exact range
 - there's also `check_no_mismatches` for when we explicitly just want to check that there are no type mismatches without giving any annotations (`check` will fail without annotations)
 - test annotations can now be overlapping (they point to the nearest line that has actual code in that range):
```
// ^^^^ annotation
//    ^^^^^^^^^ another annotation
```

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 20, 2021

Build failed:

@flodiebold
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 20, 2021

@bors bors bot merged commit 3898387 into rust-lang:master Jun 20, 2021
@matklad
Copy link
Contributor

matklad commented Jun 20, 2021

Great cleanup, thanks for working on this!

I wonder if, at some point, we should invest into auto-updating annotations? I've just realized that, with #[track_caller], we arguable can make expect! to work without macros?

@flodiebold flodiebold deleted the better-ty-tests branch June 20, 2021 17:54
@flodiebold
Copy link
Member Author

Yeah, I was considering that as well... I'm not sure how useful auto-updating these annotations will be though. I don't expect them to change that much.

@jonas-schievink jonas-schievink changed the title Refactor / clean up hir_ty tests internal: Refactor / clean up hir_ty tests Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants