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 19, 2024
1 parent 9cd41fe commit dc6e62d
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 @@ -90,6 +90,16 @@ Line 15, col 5:
"
`;
exports[`resolveDescriptors should fail descriptors for contract-duplicate-const-string-receiver5 1`] = `
"<unknown>:25:5: Invalid comment receiver selector
Line 25, col 5:
24 |
> 25 | receive(self.struct.s) {
^~~~~~~~~~~~~~~~~~~~~~~~
26 |
"
`;
exports[`resolveDescriptors should fail descriptors for contract-duplicate-external-fallback-receiver 1`] = `
"<unknown>:20:5: Empty receive function already exists
Line 20, col 5:
Expand Down
6 changes: 5 additions & 1 deletion src/types/resolveDescriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,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
throwSyntaxError(
Expand Down
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 dc6e62d

Please sign in to comment.