What's your issue about?
Currently vyper does not provide meaningful errors when incorrectly attempting imports.
When attempting to compile an incorrect relative import, such as:
# myContract.vy
# foobar.vy does not exist or is named foo_bar.vy
import foobar as FooBar
stored_data: uint256
@public
def set(new_value : uint256):
self.stored_data = new_value
@public
@constant
def get() -> uint256:
return self.stored_data
Calling vyper myContract.vy returns:
IndexError: tuple index out of range
How can it be fixed?
When comparing the behavior of vyper to solc, given a contract such as:
// myContract.sol
pragma solidity >=0.4.0 <0.7.0;
// foobar.sol doesn't exist or was renamed to foo_bar.sol
import "./foobar.sol";
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
Calling solc myContract.sol returns:
myContract.sol:5:1: Error: Source "foobar.sol" not found: File outside of allowed directories.
import "./foobar.sol";
^--------------------^
Conversely, calling solc myContract.sol --allow-paths . returns:
myContract.sol:5:1: Error: Source "foobar.sol" not found: File not found.
import "./foobar.sol";
^--------------------^
I imagine something in a similar vein would be a useful feature for vyper to have.
What's your issue about?
Currently vyper does not provide meaningful errors when incorrectly attempting imports.
When attempting to compile an incorrect relative import, such as:
Calling
vyper myContract.vyreturns:How can it be fixed?
When comparing the behavior of vyper to solc, given a contract such as:
Calling
solc myContract.solreturns:Conversely, calling
solc myContract.sol --allow-paths .returns:I imagine something in a similar vein would be a useful feature for vyper to have.