Skip to content

Commit

Permalink
fix lvalue path limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Jun 11, 2024
1 parent 9ab54ff commit 28a7116
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/types/__snapshots__/resolveDescriptors.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ Line 15, col 5:
"
`;
exports[`resolveDescriptors should fail descriptors for case-34 1`] = `
"<unknown>:25:5: Invalid comment receiver selector
Line 25, col 5:
24 |
> 25 | receive(self.struct.s) {
^~~~~~~~~~~~~~~~~~~~~~~~
26 |
"
`;
exports[`resolveDescriptors should resolve descriptors for case-0 1`] = `
{
"BaseTrait": {
Expand Down
6 changes: 5 additions & 1 deletion src/types/resolveDescriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,11 @@ export function resolveDescriptors(ctx: CompilerContext) {
const internal =
d.selector.kind === "internal-const-comment";

if (d.selector.comment.length > 2) {
if (
d.selector.comment.length > 2 ||
(d.selector.comment.length == 2 &&
d.selector.comment[0].name !== "self")
) {
// TEMPORARY
// to be reworked after #284 and #400 are resolved
throwError(
Expand Down
28 changes: 28 additions & 0 deletions src/types/test-failed/case-34.tact
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
primitive Int;
primitive String;

trait BaseTrait {

}

struct MyStruct {
s: String;
}

contract Main {
struct: MyStruct;

init () {
self.struct = MyStruct {
s: "string 1"
};
}

receive("string 1") {

}

receive(self.struct.s) {

}
}

0 comments on commit 28a7116

Please sign in to comment.