aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/tests/regression.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs
index 6c5d39549..aa948dcbf 100644
--- a/crates/ra_hir_ty/src/tests/regression.rs
+++ b/crates/ra_hir_ty/src/tests/regression.rs
@@ -2,6 +2,8 @@ use insta::assert_snapshot;
2use test_utils::covers; 2use test_utils::covers;
3 3
4use super::infer; 4use super::infer;
5use crate::test_db::TestDB;
6use ra_db::fixture::WithFixture;
5 7
6#[test] 8#[test]
7fn bug_484() { 9fn bug_484() {
@@ -399,3 +401,55 @@ fn test() {
399 "### 401 "###
400 ); 402 );
401} 403}
404
405#[test]
406fn issue_2683_chars_impl() {
407 let (db, pos) = TestDB::with_position(
408 r#"
409//- /main.rs crate:main deps:std
410fn test() {
411 let chars: std::str::Chars<'_>;
412 (chars.next(), chars.nth(1))<|>;
413}
414
415//- /std.rs crate:std
416#[prelude_import]
417use prelude::*;
418
419pub mod prelude {
420 pub use crate::iter::Iterator;
421 pub use crate::option::Option;
422}
423
424pub mod iter {
425 pub use self::traits::Iterator;
426 pub mod traits {
427 pub use self::iterator::Iterator;
428
429 pub mod iterator {
430 pub trait Iterator {
431 type Item;
432 fn next(&mut self) -> Option<Self::Item>;
433 fn nth(&mut self, n: usize) -> Option<Self::Item> {}
434 }
435 }
436 }
437}
438
439pub mod option {
440 pub enum Option<T> {}
441}
442
443pub mod str {
444 pub struct Chars<'a> {}
445 impl<'a> Iterator for Chars<'a> {
446 type Item = char;
447 fn next(&mut self) -> Option<char> {}
448 }
449}
450"#,
451 );
452
453 // should be Option<char>, but currently not because of Chalk ambiguity problem
454 assert_eq!("(Option<{unknown}>, Option<{unknown}>)", super::type_at_pos(&db, pos));
455}