forked from hyperledger-solang/solang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
address.code
in sema (hyperledger-solang#1549)
- Loading branch information
Showing
12 changed files
with
97 additions
and
31 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
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,10 @@ | ||
contract UpgradeableProxy { | ||
function _setImplementation( | ||
address newImplementation | ||
) public pure returns (uint) { | ||
return newImplementation.code; | ||
} | ||
} | ||
|
||
// ---- Expect: diagnostics ---- | ||
// error: 5:9-38: conversion from bytes to uint256 not possible |
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,10 @@ | ||
contract UpgradeableProxy { | ||
function _setImplementation( | ||
address newImplementation | ||
) public pure returns (bytes memory) { | ||
return newImplementation.code; | ||
} | ||
} | ||
|
||
// ---- Expect: diagnostics ---- | ||
// error: 5:16-38: function declared 'pure' but this expression reads from state |
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,9 @@ | ||
contract UpgradeableProxy { | ||
function _setImplementation( | ||
address newImplementation | ||
) public view returns (bytes memory) { | ||
return newImplementation.code; | ||
} | ||
} | ||
|
||
// ---- Expect: diagnostics ---- |
10 changes: 10 additions & 0 deletions
10
tests/contract_testcases/polkadot/builtins/address_code_01.sol
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,10 @@ | ||
contract UpgradeableProxy { | ||
function _setImplementation( | ||
address newImplementation | ||
) public pure returns (bytes) { | ||
return newImplementation.code; | ||
} | ||
} | ||
|
||
// ---- Expect: diagnostics ---- | ||
// error: 5:16-33: 'address.code' is not supported on Polkadot |
8 changes: 8 additions & 0 deletions
8
tests/contract_testcases/polkadot/builtins/address_code_02.sol
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,8 @@ | ||
contract UpgradeableProxy { | ||
function _setImplementation(address newImplementation) public view { | ||
assert(newImplementation.code.length != 0); | ||
} | ||
} | ||
|
||
// ---- Expect: diagnostics ---- | ||
// error: 3:16-33: 'address.code' is not supported on Polkadot |
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