mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-01 20:55:58 +01:00
By adding a constant to ClassDecl/InterfaceDecl, we're able to remove name reference special-casing. Use TryEvalInst on the Decl to generate the Type. For ClassDecl, then use the generated constant for self_type_id.
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
|
|
interface Empty {
|
|
}
|
|
|
|
interface ForwardDeclared;
|
|
|
|
interface ForwardDeclared {
|
|
fn F();
|
|
}
|
|
|
|
// CHECK:STDOUT: --- basic.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %.1: type = interface_type @Empty [template]
|
|
// CHECK:STDOUT: %.2: type = interface_type @ForwardDeclared [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc10} [template]
|
|
// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1]
|
|
// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, () [template = constants.%.2]
|
|
// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, () [template = constants.%.2]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @Empty {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @ForwardDeclared {
|
|
// CHECK:STDOUT: %F: <function> = fn_decl @F [template]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .F = %F
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F();
|
|
// CHECK:STDOUT:
|