Files
carbon-lang/explorer/testdata/assoc_const/fail_different_value.carbon
T
2023-06-15 08:42:14 -07:00

26 lines
627 B
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
package ExplorerTest api;
interface Iface {
let N:! i32;
}
fn F(T:! Iface where .N == 5) {}
class Good {}
class Bad {}
impl Good as Iface where .N = 5 {}
impl Bad as Iface where .N = 4 {}
fn Main() -> i32 {
F(Good);
// CHECK:STDERR: COMPILATION ERROR: fail_different_value.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.N) (with value 4) == 5, which is not known to be true
F(Bad);
return 0;
}