-
-
Notifications
You must be signed in to change notification settings - Fork 375
return all referenced types for typeDefinition #2246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,12 @@ test "global variable" { | |
); | ||
|
||
try testDefinition( | ||
\\const S = <tdef>struct</tdef> { alpha: u32 }; | ||
\\const <tdef>S</tdef> = struct { alpha: u32 }; | ||
\\const <>s: S = S{ .alpha = 5 }; | ||
); | ||
|
||
try testDefinition( | ||
\\const S = <tdef>struct</tdef> { alpha: u32 }; | ||
\\const <tdef>S</tdef> = struct { alpha: u32 }; | ||
\\const <>s = S{ .alpha = 5 }; | ||
); | ||
} | ||
|
@@ -107,8 +107,8 @@ test "struct init" { | |
|
||
test "decl literal on generic type" { | ||
try testDefinition( | ||
\\fn Box(comptime T: type) type { | ||
\\ return <tdef>struct</tdef> { | ||
\\fn <tdef>Box</tdef>(comptime T: type) type { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this change desirable here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm mostly indifferent to this change. But if we are going to change this then we should at least remain consistent:
Either both go to This will also need to handle cases like these where it needs to fall back to the old behavior: const s = (struct { alpha: u32 }){ .alpha = 5 }; const Foo = (struct {});
var foo = Foo{}; |
||
\\ return struct { | ||
\\ item: T, | ||
\\ const <def><decl>init</decl></def>: @This() = undefined; | ||
\\ }; | ||
|
@@ -122,7 +122,7 @@ test "decl literal on generic type" { | |
test "capture" { | ||
try testDefinition( | ||
\\test { | ||
\\ const S = <tdef>struct</tdef> {}; | ||
\\ const <tdef>S</tdef> = struct {}; | ||
\\ var maybe: ?S = 5; | ||
\\ if (maybe) |<>some| {} | ||
\\} | ||
|
@@ -242,6 +242,14 @@ test "non labeled break" { | |
); | ||
} | ||
|
||
test "function references" { | ||
try testDefinition( | ||
\\const <tdef>A</tdef> = struct {}; | ||
\\const <tdef>B</tdef> = struct {}; | ||
\\fn fo<>o(_: A) B {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this fails, need to update the tests to work with |
||
); | ||
} | ||
|
||
/// - use `<>` to indicate the cursor position | ||
/// - use `<decl>content</decl>` to set the expected range of the declaration | ||
/// - use `<def>content</def>` to set the expected range of the definition | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels too easy to work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe because it's just that simple. A test case would be need however.
This logic has since been moved here.