fail_base_unbound.carbon 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. base class B {}
  7. class C {
  8. extend base: B;
  9. }
  10. // CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+3]]:12: ERROR: Expression cannot be used as a value.
  11. // CHECK:STDERR: let b: B = C.base;
  12. // CHECK:STDERR: ^~~~~~
  13. let b: B = C.base;
  14. // CHECK:STDOUT: --- fail_base_unbound.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %B: type = class_type @B [template]
  18. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  19. // CHECK:STDOUT: %C: type = class_type @C [template]
  20. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  21. // CHECK:STDOUT: %.3: type = ptr_type {} [template]
  22. // CHECK:STDOUT: %.4: type = unbound_element_type C, B [template]
  23. // CHECK:STDOUT: %.5: type = struct_type {.base: B} [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace {
  28. // CHECK:STDOUT: .B = %B.decl
  29. // CHECK:STDOUT: .C = %C.decl
  30. // CHECK:STDOUT: } [template]
  31. // CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B]
  32. // CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C]
  33. // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B]
  34. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  35. // CHECK:STDOUT: %base.ref: <unbound element of class C> = name_ref base, @C.%.loc10 [template = @C.%.loc10]
  36. // CHECK:STDOUT: %b: B = bind_name b, <error>
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: class @B {
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: !members:
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: class @C {
  45. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  46. // CHECK:STDOUT: %.loc10: <unbound element of class C> = base_decl B, element0 [template]
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: !members:
  49. // CHECK:STDOUT: .base = %.loc10
  50. // CHECK:STDOUT: extend name_scope1
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: