fail_missing_member.carbon 708 B

12345678910111213141516171819202122232425
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. package ExplorerTest api;
  7. interface A { fn F() -> i32; }
  8. interface B { fn G() -> i32; }
  9. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/constraint/fail_missing_member.carbon:[[@LINE+1]]: member access, H not in interface A & interface B where T impls interface A and T impls interface B
  10. fn Get[T:! A & B](n: T) -> i32 { return n.H(); }
  11. impl i32 as A {
  12. fn F() -> i32 { return 1; }
  13. }
  14. impl i32 as B {
  15. fn G() -> i32 { return 2; }
  16. }
  17. fn Main() -> i32 {
  18. var z: i32 = 0;
  19. return Get(z);
  20. }