-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
External Calling Issue
File 1:
The function Change in Bar changes the value of the global variable Value. Bar compiles and deploys correctly and the function produces the correct result.
contract Bar {
public var Value: Int = 0
}
Bar :: caller <- (any) {
public init(Start: Int) {
Value = Start
}
public func Change(NewValue: Int) mutates (Value) {
Value = NewValue
}
}
File 2:
external trait Bar {
func Change(value: int256)
}
contract Foo: {
let BarAdd: Address = 0x0DCd2F752394c41875e259e00bb44fd505297caF
}
Foo :: caller <- (any) {
public init () {
}
public func changeBar(New: Int) {
let B: Bar = Bar (address: BarAdd)
call! B.Change (value: New as! int256)
}
}
The function changeBar in Foo seeks to amend the same variable by means of an external call. The flint compiler compiles this version of Foo but the Solidity compiler gives an error message:
DeclarationError: Unbalanced stack at the end of a block: 1 surplus item(s).
function Foo$changeBar$Int(_New) {
^ (Relevant source part starts here and spans across multiple lines).
This refers to a variable $temp2 which appears at the end of the Solidity function definition.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels