/* ----------------------------------------------------------------------------- Copyright 2020 Kevin P. Barry Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------------- */ // Author: Kevin P. Barry [ta0kira@gmail.com] testcase "multi return to call" { error require "call.+\{Value,Value\}" } @value interface Value { get () -> (Value,Value) call () -> () } define Test { @value process (Value) -> () process (value) { \ value.get().call() } } concrete Test {} testcase "zero return to call" { error require "call.+\{\}" } @value interface Value { get () -> () call () -> () } define Test { @value process (Value) -> () process (value) { \ value.get().call() } } concrete Test {} testcase "multi return assign" { success } unittest test { Test value <- Test.create() _, Test value2 <- value.double() value, _ <- value2.double() } concrete Test { @type create () -> (Test) @value double () -> (Test,Test) } define Test { create () { return Test{} } double () { return self, self } } testcase "multi return as args" { success } unittest test { \ Test.call(Test.get()) } define Test { get () { return 1, 2 } call (x,y) { if (x != 1) { fail("Failed") } if (y != 2) { fail("Failed") } } } concrete Test { @type get () -> (Int,Int) @type call (Int,Int) -> () }