/* ----------------------------------------------------------------------------- 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 "warning statement after fail" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { fail("Failed") return 1 } run () {} } concrete Test { @type run () -> () } testcase "warning statement after return" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { return 0 return 1 } run () {} } concrete Test { @type run () -> () } testcase "warning statement after conditional return" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { if (true) { return 1 } else { return 2 } return 3 } run () {} } concrete Test { @type run () -> () } testcase "warning statement after scoped return" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { scoped { return 1 } in return 2 } run () {} } concrete Test { @type run () -> () } testcase "warning statement after cleanup return" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { scoped { } cleanup { return 1 } in \ empty return 2 } run () {} } concrete Test { @type run () -> () } testcase "warning statement in cleanup after scoped return" { success Test$run() require compiler "unreachable" } define Test { @category failedReturn () -> (Int) failedReturn () { scoped { return 1 } cleanup { return 2 } in \ empty } run () {} } concrete Test { @type run () -> () }