-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDynamicSizedReturnValue.sol
More file actions
47 lines (35 loc) · 1.03 KB
/
DynamicSizedReturnValue.sol
File metadata and controls
47 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
pragma solidity ^0.4.6;
/// @title Strig Return - Fails
contract ReturnsString {
string private demoString;
function getStringExternal() external returns(string) {
return demoString;
}
}
contract ReceivesString {
ReturnsString test;
function Fail() {
test = new ReturnsString();
}
function getString() returns(string) {
string str = test.getStringExternal(); // Type inaccessible dynamic type is not implicitly convertible to expected type string storage pointer.
}
}
/// @title Dynamic Array Return - Fails
contract ReturnsDynamicArray {
address[] forms;
function addForm(address form){
forms.push(form);
}
function getForms() public returns(address[]){
return forms;
}
}
contract ReceivesDynamicArray {
function getForms() returns(uint) {
ReturnsDynamicArray t = new ReturnsDynamicArray();
t.addForm(address(0x1));
var forms = t.getForms();
return forms.length; // Member "length" not found or not visible after argument-dependent lookup in inaccessible dynamic type
}
}