hyperledger / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.25k stars 208 forks source link

`assembly("memory-safe")` causes failure during parse_and_resolve #1526

Closed BenTheKush closed 11 months ago

BenTheKush commented 11 months ago

Describe the bug When I run parse_and_resolve on a file with assembly("memory-safe") in it I a flag: memory-safe not supported error. I've added this to this repo and I'm including a minimal reproducible bug for convenience:

issue1526.sol:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

library Issue1526 {
    function extSloads() public pure {
        assembly ("memory-safe") {

        }
    }
}

Running

$ solang compile --target solana issue1526.sol
error: flag 'memory-safe' not supported
  ┌─ /Users/benku/Playground/1526.sol:6:19
  │
6 │         assembly ("memory-safe") {
  │                   ^^^^^^^^^^^^^

This actually doesn't demonstrate the bug: it's fine for solang to fail, but it should fail after building an AST (unless there are constraints I don't know about). But I have a working example in my repository that I linked above that shows that this fails during parse_and_resolve()