fail_vacuous_access.carbon 666 B

1234567891011121314151617181920
  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. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package Foo api;
  9. interface A { fn F() -> i32; }
  10. class X {
  11. impl as A {
  12. fn F() -> i32 { return 1; }
  13. }
  14. }
  15. fn Main() -> i32 {
  16. var a: X = {};
  17. // 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
  18. return a.(X.(A.F))();
  19. }