Unnamed repository; edit this file 'description' to name the repository.
test: add test case for `Self`
Young-Flash 2023-12-26
parent 8a0a3b2 · commit 67f001e
-rw-r--r--crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
index b55344f157..2e0a628eee 100644
--- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -452,6 +452,27 @@ mod tests {
use super::*;
#[test]
+ fn issue_16197() {
+ check_assist(
+ extract_struct_from_enum_variant,
+ r#"
+enum Foo {
+ Bar $0{ node: Box<Self> },
+ Nil,
+}
+"#,
+ r#"
+struct Bar{ node: Box<Foo> }
+
+enum Foo {
+ Bar(Bar),
+ Nil,
+}
+"#,
+ );
+ }
+
+ #[test]
fn test_extract_struct_several_fields_tuple() {
check_assist(
extract_struct_from_enum_variant,