-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(all): initial support for a destruct statement (#355)
- Loading branch information
Showing
17 changed files
with
8,318 additions
and
6,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
======================================================================== | ||
Simple destruct with single variable | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number } = get42(); | ||
} | ||
------------------------------------------------------------------------ | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int/* as int257 */ = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number/* : Int */ } = get42(); | ||
} | ||
|
||
======================================================================== | ||
Simple destruct with single renamed variable | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number: other } = get42(); | ||
} | ||
------------------------------------------------------------------------ | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int/* as int257 */ = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number: other/* : Int */ } = get42(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
======================================================================== | ||
Simple destruct with single variable for field | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
<caret>number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number } = get42(); | ||
number; | ||
} | ||
------------------------------------------------------------------------ | ||
References: [] | ||
Scope: GlobalSearchScope | ||
|
||
======================================================================== | ||
Simple destruct with single renamed variable | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
<caret>number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { number: other } = get42(); | ||
} | ||
------------------------------------------------------------------------ | ||
References: [9:18] | ||
Scope: GlobalSearchScope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
======================================================================== | ||
Simple destruct with single variable | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { <caret>number } = get42(); | ||
<caret>number; | ||
} | ||
------------------------------------------------------------------------ | ||
9:18 -> 9:18 resolved | ||
10:4 -> 9:18 resolved | ||
|
||
======================================================================== | ||
Simple destruct with single renamed variable | ||
======================================================================== | ||
primitive Int; | ||
|
||
struct Example { | ||
number: Int = 0; | ||
} | ||
|
||
fun get42(): Example { return Example{} } | ||
|
||
fun foo() { | ||
let Example { <caret>number: other } = get42(); | ||
<caret>number; | ||
<caret>other; | ||
} | ||
------------------------------------------------------------------------ | ||
9:18 -> 3:4 resolved | ||
10:4 unresolved | ||
11:4 -> 9:26 resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.