Skip to content
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

docs: barArray should be a static array #1288

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

0xkowloon
Copy link
Contributor

If this is not a static array it will throw the error

➜  contracts git:(main) ✗ forge test
[⠆] Compiling...
[⠢] Compiling 5 files with 0.8.13
[⠆] Solc 0.8.13 finished in 899.89ms
Error:
Compiler run failed:
Error (9582): Member "set" not found or not visible after argument-dependent lookup in type(library MyTable).
  --> src/systems/MyTableSystem.sol:23:5:
   |
23 |     MyTable.set(keccak256("some.key"), 45, false, fooArray, barArray);
   |     ^^^^^^^^^^^

If this is not a static array it will throw the error

```
➜  contracts git:(main) ✗ forge test
[⠆] Compiling...
[⠢] Compiling 5 files with 0.8.13
[⠆] Solc 0.8.13 finished in 899.89ms
Error:
Compiler run failed:
Error (9582): Member "set" not found or not visible after argument-dependent lookup in type(library MyTable).
  --> src/systems/MyTableSystem.sol:23:5:
   |
23 |     MyTable.set(keccak256("some.key"), 45, false, fooArray, barArray);
   |     ^^^^^^^^^^^
```
@0xkowloon 0xkowloon requested review from alvrs and holic as code owners August 12, 2023 12:24
@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2023

⚠️ No Changeset found

Latest commit: 790a24a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@holic holic changed the title fix: barArray should be a static array docs: barArray should be a static array Aug 12, 2023
@@ -36,7 +36,7 @@ tables: {
```solidity
// Setting a record
uint256[] memory fooArray = new uint256[](1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this likewise be

Suggested change
uint256[] memory fooArray = new uint256[](1);
uint256[1] memory fooArray;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because fooArray is a dynamic array in the table definition

@holic holic merged commit 162ca7d into latticexyz:main Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants