fail_field_access_mismatch_base.carbon 655 B

123456789101112131415161718192021222324
  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 ExplorerTest api;
  9. base class Point {
  10. var x: i32;
  11. var y: i32;
  12. }
  13. class Point3D extends Point {
  14. var z: i32;
  15. }
  16. fn Main() -> i32 {
  17. var p: Point3D = {.base={.x = 1, .y = 2}, .z = 3};
  18. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/class/fail_field_access_mismatch_base.carbon:[[@LINE+1]]: class Point3D does not have a field named a
  19. return p.a;
  20. }