mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
This PR is making two main changes to the Explorer and Toolchain: - Replace the `is` keyword in `where SomeType is SomeInterface` with `impls`, so it is `where SomeType impls SomeInterface` - Rewrite uses of the "impls" to something else to avoid, frequently "`impl` declarations" or "implementations", to avoid confusion with the `impls` keyword. --------- Co-authored-by: Geoff Romer <gromer@google.com>
374 lines
7.4 KiB
Plaintext
374 lines
7.4 KiB
Plaintext
compilation_unit {
|
|
package_statement {
|
|
package_name: "ExplorerTest"
|
|
}
|
|
is_api: true
|
|
declarations {
|
|
interface {
|
|
name {
|
|
name: "A"
|
|
}
|
|
members {
|
|
function {
|
|
name {
|
|
name: "F"
|
|
}
|
|
param_pattern {
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
interface {
|
|
name {
|
|
name: "B"
|
|
}
|
|
members {
|
|
function {
|
|
name {
|
|
name: "F"
|
|
}
|
|
param_pattern {
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
impl {
|
|
kind: InternalImpl
|
|
impl_type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
interface {
|
|
identifier {
|
|
name: "A"
|
|
}
|
|
}
|
|
members {
|
|
function {
|
|
name {
|
|
name: "F"
|
|
}
|
|
param_pattern {
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
body {
|
|
statements {
|
|
return_expression_statement {
|
|
expression {
|
|
int_literal {
|
|
value: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
impl {
|
|
kind: InternalImpl
|
|
impl_type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
interface {
|
|
identifier {
|
|
name: "B"
|
|
}
|
|
}
|
|
members {
|
|
function {
|
|
name {
|
|
name: "F"
|
|
}
|
|
param_pattern {
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
body {
|
|
statements {
|
|
return_expression_statement {
|
|
expression {
|
|
int_literal {
|
|
value: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
function {
|
|
name {
|
|
name: "GetA"
|
|
}
|
|
deduced_parameters {
|
|
name: "T"
|
|
type {
|
|
identifier {
|
|
name: "A"
|
|
}
|
|
}
|
|
}
|
|
param_pattern {
|
|
fields {
|
|
binding_pattern {
|
|
name: "x"
|
|
type {
|
|
expression_pattern {
|
|
expression {
|
|
identifier {
|
|
name: "T"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
body {
|
|
statements {
|
|
return_expression_statement {
|
|
expression {
|
|
call {
|
|
function {
|
|
simple_member_access {
|
|
field: "F"
|
|
object {
|
|
identifier {
|
|
name: "x"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
argument {
|
|
tuple_literal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
function {
|
|
name {
|
|
name: "GetAB"
|
|
}
|
|
deduced_parameters {
|
|
name: "T"
|
|
type {
|
|
where {
|
|
base {
|
|
identifier {
|
|
name: "B"
|
|
}
|
|
}
|
|
clauses {
|
|
impls {
|
|
type {
|
|
designator {
|
|
name: "Self"
|
|
}
|
|
}
|
|
constraint {
|
|
identifier {
|
|
name: "A"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
param_pattern {
|
|
fields {
|
|
binding_pattern {
|
|
name: "x"
|
|
type {
|
|
expression_pattern {
|
|
expression {
|
|
identifier {
|
|
name: "T"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
body {
|
|
statements {
|
|
return_expression_statement {
|
|
expression {
|
|
operator {
|
|
op: Add
|
|
arguments {
|
|
operator {
|
|
op: Mul
|
|
arguments {
|
|
int_literal {
|
|
value: 10
|
|
}
|
|
}
|
|
arguments {
|
|
call {
|
|
function {
|
|
identifier {
|
|
name: "GetA"
|
|
}
|
|
}
|
|
argument {
|
|
tuple_literal {
|
|
fields {
|
|
identifier {
|
|
name: "x"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
arguments {
|
|
call {
|
|
function {
|
|
simple_member_access {
|
|
field: "F"
|
|
object {
|
|
identifier {
|
|
name: "x"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
argument {
|
|
tuple_literal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
declarations {
|
|
function {
|
|
name {
|
|
name: "Main"
|
|
}
|
|
param_pattern {
|
|
}
|
|
return_term {
|
|
kind: Expression
|
|
type {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
body {
|
|
statements {
|
|
variable_definition {
|
|
pattern {
|
|
binding_pattern {
|
|
name: "v"
|
|
type {
|
|
expression_pattern {
|
|
expression {
|
|
int_type_literal {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
init {
|
|
int_literal {
|
|
value: 0
|
|
}
|
|
}
|
|
is_returned: false
|
|
}
|
|
}
|
|
statements {
|
|
return_expression_statement {
|
|
expression {
|
|
call {
|
|
function {
|
|
identifier {
|
|
name: "GetAB"
|
|
}
|
|
}
|
|
argument {
|
|
tuple_literal {
|
|
fields {
|
|
identifier {
|
|
name: "v"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|