fail_vacuous_access.carbon 591 B

123456789101112131415161718
  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 Foo api;
  7. interface A { fn F() -> i32; }
  8. class X {
  9. impl as A {
  10. fn F() -> i32 { return 1; }
  11. }
  12. }
  13. fn Main() -> i32 {
  14. var a: X = {};
  15. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/member_access/fail_vacuous_access.carbon:[[@LINE+1]]: expected name of instance member or interface member in compound member access, found fn () -> i32
  16. return a.(X.(A.F))();
  17. }