fail_field_assign_mismatch_base.carbon 589 B

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