// OPT_IN: kotlin.contracts.ExperimentalContracts

/*
 * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE)
 *
 * SECTIONS: contracts, declarations, contractBuilder, effects, callsInPlace
 * NUMBER: 2
 * DESCRIPTION: functions with contract and duplicate CallsInPlace.
 * ISSUES: KT-26150
 */

import kotlin.contracts.*

// TESTCASE NUMBER: 1
inline fun case_1(block: () -> Unit) {
    <!ERROR_IN_CONTRACT_DESCRIPTION!>contract {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
    }<!>
    return block()
}

// TESTCASE NUMBER: 2
inline fun case_2(block: () -> Unit) {
    <!ERROR_IN_CONTRACT_DESCRIPTION!>contract {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
        callsInPlace(block, InvocationKind.AT_MOST_ONCE)
    }<!>
    return block()
}
