Add support for most kinds of declarations to be declared and used as namespace members (#2575)

Support for global variables is still missing; they're a bit more tricky because they use a pattern to introduce their name.

Prior to this change, explorer heavily relied on name comparisons to determine whether two declarations declare the same entity. Some of those instances are fixed in this PR, but more remain to be fixed, and some TODOs are added for some harder-to-fix instances.
This commit is contained in:
Richard Smith
2023-02-08 13:21:15 -08:00
committed by GitHub
parent 245e4d1ea6
commit 4fa71e32f5
604 changed files with 66695 additions and 5173 deletions
+13 -8
View File
@@ -11,6 +11,11 @@ message LibraryName {
optional string path = 2;
}
message DeclaredName {
repeated string qualifiers = 1;
optional string name = 2;
}
// Expressions.
message CallExpression {
@@ -358,7 +363,7 @@ message ReturnTerm {
}
message FunctionDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated GenericBinding deduced_parameters = 2;
optional Pattern self_pattern = 3;
optional TuplePattern param_pattern = 4;
@@ -372,7 +377,7 @@ message DestructorDeclaration {
}
message ClassDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated Declaration members = 2;
optional TuplePattern type_params = 3;
}
@@ -383,7 +388,7 @@ message AlternativeSignature {
}
message ChoiceDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated AlternativeSignature alternatives = 2;
}
@@ -408,12 +413,12 @@ message InterfaceImplDeclaration {
}
message InterfaceDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated Declaration members = 2;
}
message ConstraintDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated Declaration members = 2;
}
@@ -435,13 +440,13 @@ message MatchFirstDeclaration {
}
message AliasDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
optional Expression target = 2;
}
// EXPERIMENTAL MIXIN FEATURE
message MixinDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
repeated Declaration members = 2;
// Type params not implemented yet
// optional TuplePattern params = 3;
@@ -454,7 +459,7 @@ message MixDeclaration {
}
message NamespaceDeclaration {
optional string name = 1;
optional DeclaredName name = 1;
}
message Declaration {
+19 -8
View File
@@ -715,6 +715,15 @@ static auto ReturnTermToCarbon(const Fuzzing::ReturnTerm& return_term,
}
}
static auto DeclaredNameToCarbon(const Fuzzing::DeclaredName& name,
llvm::raw_ostream& out) -> void {
for (const std::string& qual : name.qualifiers()) {
IdentifierToCarbon(qual, out);
out << ".";
}
IdentifierToCarbon(name.name(), out);
}
static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
llvm::raw_ostream& out) -> void {
switch (declaration.kind_case()) {
@@ -725,7 +734,9 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
}
case Fuzzing::Declaration::kNamespace: {
out << "namespace " << declaration.namespace_().name() << ";";
out << "namespace ";
DeclaredNameToCarbon(declaration.namespace_().name(), out);
out << ";";
break;
}
@@ -753,7 +764,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kFunction: {
const auto& function = declaration.function();
out << "fn ";
IdentifierToCarbon(function.name(), out);
DeclaredNameToCarbon(function.name(), out);
if (!function.deduced_parameters().empty() ||
function.has_self_pattern()) {
@@ -786,7 +797,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kClassDeclaration: {
const auto& class_declaration = declaration.class_declaration();
out << "class ";
IdentifierToCarbon(class_declaration.name(), out);
DeclaredNameToCarbon(class_declaration.name(), out);
// type_params is optional.
if (class_declaration.has_type_params()) {
@@ -806,7 +817,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kMixin: {
const auto& mixin_declaration = declaration.mixin();
out << "__mixin ";
IdentifierToCarbon(mixin_declaration.name(), out);
DeclaredNameToCarbon(mixin_declaration.name(), out);
// type params are not implemented yet
// if (mixin_declaration.has_params()) {
@@ -835,7 +846,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kChoice: {
const auto& choice = declaration.choice();
out << "choice ";
IdentifierToCarbon(choice.name(), out);
DeclaredNameToCarbon(choice.name(), out);
out << "{";
llvm::ListSeparator sep;
@@ -897,7 +908,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kInterface: {
const auto& interface = declaration.interface();
out << "interface ";
IdentifierToCarbon(interface.name(), out);
DeclaredNameToCarbon(interface.name(), out);
out << " {\n";
for (const auto& member : interface.members()) {
DeclarationToCarbon(member, out);
@@ -910,7 +921,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kConstraint: {
const auto& constraint = declaration.constraint();
out << "constraint ";
IdentifierToCarbon(constraint.name(), out);
DeclaredNameToCarbon(constraint.name(), out);
out << " {\n";
for (const auto& member : constraint.members()) {
DeclarationToCarbon(member, out);
@@ -952,7 +963,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
case Fuzzing::Declaration::kAlias: {
const auto& alias = declaration.alias();
out << "alias ";
IdentifierToCarbon(alias.name(), out);
DeclaredNameToCarbon(alias.name(), out);
out << " = ";
ExpressionToCarbon(alias.target(), out);
out << ";";
+6 -6
View File
@@ -236,24 +236,24 @@ auto GetName(const Declaration& declaration)
-> std::optional<std::string_view> {
switch (declaration.kind()) {
case DeclarationKind::NamespaceDeclaration:
return cast<NamespaceDeclaration>(declaration).name();
return cast<NamespaceDeclaration>(declaration).name().inner_name();
case DeclarationKind::FunctionDeclaration:
return cast<FunctionDeclaration>(declaration).name().inner_name();
case DeclarationKind::DestructorDeclaration:
return "destructor";
case DeclarationKind::ClassDeclaration:
return cast<ClassDeclaration>(declaration).name();
return cast<ClassDeclaration>(declaration).name().inner_name();
case DeclarationKind::MixinDeclaration: {
return cast<MixinDeclaration>(declaration).name();
return cast<MixinDeclaration>(declaration).name().inner_name();
}
case DeclarationKind::MixDeclaration: {
return std::nullopt;
}
case DeclarationKind::ChoiceDeclaration:
return cast<ChoiceDeclaration>(declaration).name();
return cast<ChoiceDeclaration>(declaration).name().inner_name();
case DeclarationKind::InterfaceDeclaration:
case DeclarationKind::ConstraintDeclaration:
return cast<ConstraintTypeDeclaration>(declaration).name();
return cast<ConstraintTypeDeclaration>(declaration).name().inner_name();
case DeclarationKind::VariableDeclaration:
return cast<VariableDeclaration>(declaration).binding().name();
case DeclarationKind::AssociatedConstantDeclaration:
@@ -266,7 +266,7 @@ auto GetName(const Declaration& declaration)
case DeclarationKind::SelfDeclaration:
return SelfDeclaration::name();
case DeclarationKind::AliasDeclaration: {
return cast<AliasDeclaration>(declaration).name();
return cast<AliasDeclaration>(declaration).name().inner_name();
}
}
}
+28 -21
View File
@@ -126,6 +126,12 @@ class Declaration : public AstNode {
bool is_type_checked_ = false;
};
// Determine whether two declarations declare the same entity.
inline auto DeclaresSameEntity(const Declaration& first,
const Declaration& second) -> bool {
return &first == &second;
}
// A name being declared in a named declaration.
class DeclaredName {
public:
@@ -173,7 +179,7 @@ class NamespaceDeclaration : public Declaration {
public:
using ImplementsCarbonValueNode = void;
explicit NamespaceDeclaration(SourceLocation source_loc, std::string name)
explicit NamespaceDeclaration(SourceLocation source_loc, DeclaredName name)
: Declaration(AstNodeKind::NamespaceDeclaration, source_loc),
name_(std::move(name)) {}
@@ -181,11 +187,11 @@ class NamespaceDeclaration : public Declaration {
return InheritsFromNamespaceDeclaration(node->kind());
}
auto name() const -> std::string_view { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto value_category() const -> ValueCategory { return ValueCategory::Let; }
private:
std::string name_;
DeclaredName name_;
};
// A function's virtual override keyword.
@@ -326,7 +332,7 @@ class ClassDeclaration : public Declaration {
public:
using ImplementsCarbonValueNode = void;
ClassDeclaration(SourceLocation source_loc, std::string name,
ClassDeclaration(SourceLocation source_loc, DeclaredName name,
Nonnull<SelfDeclaration*> self_decl,
ClassExtensibility extensibility,
std::optional<Nonnull<TuplePattern*>> type_params,
@@ -344,7 +350,7 @@ class ClassDeclaration : public Declaration {
return InheritsFromClassDeclaration(node->kind());
}
auto name() const -> const std::string& { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto extensibility() const -> ClassExtensibility { return extensibility_; }
auto type_params() const -> std::optional<Nonnull<const TuplePattern*>> {
return type_params_;
@@ -384,7 +390,7 @@ class ClassDeclaration : public Declaration {
}
private:
std::string name_;
DeclaredName name_;
ClassExtensibility extensibility_;
Nonnull<SelfDeclaration*> self_decl_;
std::optional<Nonnull<TuplePattern*>> type_params_;
@@ -400,7 +406,7 @@ class MixinDeclaration : public Declaration {
public:
using ImplementsCarbonValueNode = void;
MixinDeclaration(SourceLocation source_loc, std::string name,
MixinDeclaration(SourceLocation source_loc, DeclaredName name,
std::optional<Nonnull<TuplePattern*>> params,
Nonnull<GenericBinding*> self,
std::vector<Nonnull<Declaration*>> members)
@@ -414,7 +420,7 @@ class MixinDeclaration : public Declaration {
return InheritsFromMixinDeclaration(node->kind());
}
auto name() const -> const std::string& { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto params() const -> std::optional<Nonnull<const TuplePattern*>> {
return params_;
}
@@ -428,7 +434,7 @@ class MixinDeclaration : public Declaration {
auto value_category() const -> ValueCategory { return ValueCategory::Let; }
private:
std::string name_;
DeclaredName name_;
std::optional<Nonnull<TuplePattern*>> params_;
Nonnull<GenericBinding*> self_;
std::vector<Nonnull<Declaration*>> members_;
@@ -487,7 +493,7 @@ class ChoiceDeclaration : public Declaration {
public:
using ImplementsCarbonValueNode = void;
ChoiceDeclaration(SourceLocation source_loc, std::string name,
ChoiceDeclaration(SourceLocation source_loc, DeclaredName name,
std::optional<Nonnull<TuplePattern*>> type_params,
std::vector<Nonnull<AlternativeSignature*>> alternatives)
: Declaration(AstNodeKind::ChoiceDeclaration, source_loc),
@@ -499,7 +505,7 @@ class ChoiceDeclaration : public Declaration {
return InheritsFromChoiceDeclaration(node->kind());
}
auto name() const -> const std::string& { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto type_params() const -> std::optional<Nonnull<const TuplePattern*>> {
return type_params_;
@@ -524,7 +530,7 @@ class ChoiceDeclaration : public Declaration {
auto value_category() const -> ValueCategory { return ValueCategory::Let; }
private:
std::string name_;
DeclaredName name_;
std::optional<Nonnull<TuplePattern*>> type_params_;
std::vector<Nonnull<AlternativeSignature*>> alternatives_;
std::vector<NamedValue> members_;
@@ -577,7 +583,7 @@ class ConstraintTypeDeclaration : public Declaration {
using ImplementsCarbonValueNode = void;
ConstraintTypeDeclaration(AstNodeKind kind, Nonnull<Arena*> arena,
SourceLocation source_loc, std::string name,
SourceLocation source_loc, DeclaredName name,
std::optional<Nonnull<TuplePattern*>> params,
std::vector<Nonnull<Declaration*>> members)
: Declaration(kind, source_loc),
@@ -586,7 +592,8 @@ class ConstraintTypeDeclaration : public Declaration {
self_type_(arena->New<SelfDeclaration>(source_loc)),
members_(std::move(members)) {
// `interface X` has `Self:! X`.
auto* self_type_ref = arena->New<IdentifierExpression>(source_loc, name);
auto* self_type_ref = arena->New<IdentifierExpression>(
source_loc, std::string(name_.inner_name()));
self_type_ref->set_value_node(self_type_);
self_ = arena->New<GenericBinding>(source_loc, "Self", self_type_ref);
}
@@ -595,7 +602,7 @@ class ConstraintTypeDeclaration : public Declaration {
return InheritsFromConstraintTypeDeclaration(node->kind());
}
auto name() const -> const std::string& { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto params() const -> std::optional<Nonnull<const TuplePattern*>> {
return params_;
}
@@ -630,7 +637,7 @@ class ConstraintTypeDeclaration : public Declaration {
}
private:
std::string name_;
DeclaredName name_;
std::optional<Nonnull<TuplePattern*>> params_;
Nonnull<SelfDeclaration*> self_type_;
Nonnull<GenericBinding*> self_;
@@ -644,7 +651,7 @@ class InterfaceDeclaration : public ConstraintTypeDeclaration {
using ImplementsCarbonValueNode = void;
InterfaceDeclaration(Nonnull<Arena*> arena, SourceLocation source_loc,
std::string name,
DeclaredName name,
std::optional<Nonnull<TuplePattern*>> params,
std::vector<Nonnull<Declaration*>> members)
: ConstraintTypeDeclaration(AstNodeKind::InterfaceDeclaration, arena,
@@ -662,7 +669,7 @@ class ConstraintDeclaration : public ConstraintTypeDeclaration {
using ImplementsCarbonValueNode = void;
ConstraintDeclaration(Nonnull<Arena*> arena, SourceLocation source_loc,
std::string name,
DeclaredName name,
std::optional<Nonnull<TuplePattern*>> params,
std::vector<Nonnull<Declaration*>> members)
: ConstraintTypeDeclaration(AstNodeKind::ConstraintDeclaration, arena,
@@ -851,7 +858,7 @@ class AliasDeclaration : public Declaration {
public:
using ImplementsCarbonValueNode = void;
explicit AliasDeclaration(SourceLocation source_loc, std::string name,
explicit AliasDeclaration(SourceLocation source_loc, DeclaredName name,
Nonnull<Expression*> target)
: Declaration(AstNodeKind::AliasDeclaration, source_loc),
name_(std::move(name)),
@@ -861,13 +868,13 @@ class AliasDeclaration : public Declaration {
return InheritsFromAliasDeclaration(node->kind());
}
auto name() const -> const std::string& { return name_; }
auto name() const -> const DeclaredName& { return name_; }
auto target() const -> const Expression& { return *target_; }
auto target() -> Expression& { return *target_; }
auto value_category() const -> ValueCategory { return ValueCategory::Let; }
private:
std::string name_;
DeclaredName name_;
Nonnull<Expression*> target_;
};
+20 -8
View File
@@ -614,6 +614,16 @@ static auto ReturnTermToProto(const ReturnTerm& return_term)
return return_term_proto;
}
static auto DeclaredNameToProto(const DeclaredName& name)
-> Fuzzing::DeclaredName {
Fuzzing::DeclaredName name_proto;
name_proto.set_name(std::string(name.inner_name()));
for (auto& [loc, qual] : name.qualifiers()) {
name_proto.add_qualifiers(qual);
}
return name_proto;
}
static auto DeclarationToProto(const Declaration& declaration)
-> Fuzzing::Declaration {
Fuzzing::Declaration declaration_proto;
@@ -621,7 +631,8 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::NamespaceDeclaration: {
const auto& namespace_decl = cast<NamespaceDeclaration>(declaration);
auto* namespace_proto = declaration_proto.mutable_namespace_();
namespace_proto->set_name(std::string(namespace_decl.name()));
*namespace_proto->mutable_name() =
DeclaredNameToProto(namespace_decl.name());
break;
}
case DeclarationKind::DestructorDeclaration: {
@@ -657,7 +668,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::FunctionDeclaration: {
const auto& function = cast<FunctionDeclaration>(declaration);
auto* function_proto = declaration_proto.mutable_function();
function_proto->set_name(std::string(function.name().inner_name()));
*function_proto->mutable_name() = DeclaredNameToProto(function.name());
for (Nonnull<const GenericBinding*> binding :
function.deduced_parameters()) {
*function_proto->add_deduced_parameters() =
@@ -697,7 +708,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::ClassDeclaration: {
const auto& class_decl = cast<ClassDeclaration>(declaration);
auto* class_proto = declaration_proto.mutable_class_declaration();
class_proto->set_name(class_decl.name());
*class_proto->mutable_name() = DeclaredNameToProto(class_decl.name());
if (class_decl.type_params().has_value()) {
*class_proto->mutable_type_params() =
TuplePatternToProto(**class_decl.type_params());
@@ -711,7 +722,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::MixinDeclaration: {
const auto& mixin = cast<MixinDeclaration>(declaration);
auto* mixin_proto = declaration_proto.mutable_mixin();
mixin_proto->set_name(mixin.name());
*mixin_proto->mutable_name() = DeclaredNameToProto(mixin.name());
for (const auto& member : mixin.members()) {
*mixin_proto->add_members() = DeclarationToProto(*member);
}
@@ -734,7 +745,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::ChoiceDeclaration: {
const auto& choice = cast<ChoiceDeclaration>(declaration);
auto* choice_proto = declaration_proto.mutable_choice();
choice_proto->set_name(choice.name());
*choice_proto->mutable_name() = DeclaredNameToProto(choice.name());
for (Nonnull<const AlternativeSignature*> alternative :
choice.alternatives()) {
auto* alternative_proto = choice_proto->add_alternatives();
@@ -781,7 +792,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::InterfaceDeclaration: {
const auto& interface = cast<InterfaceDeclaration>(declaration);
auto* interface_proto = declaration_proto.mutable_interface();
interface_proto->set_name(interface.name());
*interface_proto->mutable_name() = DeclaredNameToProto(interface.name());
for (const auto& member : interface.members()) {
*interface_proto->add_members() = DeclarationToProto(*member);
}
@@ -791,7 +802,8 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::ConstraintDeclaration: {
const auto& constraint = cast<ConstraintDeclaration>(declaration);
auto* constraint_proto = declaration_proto.mutable_constraint();
constraint_proto->set_name(constraint.name());
*constraint_proto->mutable_name() =
DeclaredNameToProto(constraint.name());
for (const auto& member : constraint.members()) {
*constraint_proto->add_members() = DeclarationToProto(*member);
}
@@ -833,7 +845,7 @@ static auto DeclarationToProto(const Declaration& declaration)
case DeclarationKind::AliasDeclaration: {
const auto& alias = cast<AliasDeclaration>(declaration);
auto* alias_proto = declaration_proto.mutable_alias();
alias_proto->set_name(alias.name());
*alias_proto->mutable_name() = DeclaredNameToProto(alias.name());
*alias_proto->mutable_target() = ExpressionToProto(alias.target());
break;
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
}
return_term {
@@ -81,7 +85,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "A"
name {
name: "A"
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -20,21 +24,18 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
interface {
name: "B"
name {
name: "B"
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -46,13 +47,6 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
@@ -69,7 +63,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -108,7 +104,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -135,7 +133,9 @@ compilation_unit {
}
declarations {
function {
name: "GetAB"
name {
name: "GetAB"
}
param_pattern {
fields {
generic_binding {
@@ -285,7 +285,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
}
}
declarations {
@@ -35,7 +37,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -76,7 +80,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -104,7 +110,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -0,0 +1,182 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "lhs"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
int_literal {
value: 8
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "rhs"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
int_literal {
value: 3
}
}
is_returned: false
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "Interface: {0}"
}
}
fields {
call {
function {
compound_member_access {
object {
identifier {
name: "lhs"
}
}
path {
simple_member_access {
field: "Op"
object {
call {
function {
identifier {
name: "ModWith"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
argument {
tuple_literal {
fields {
identifier {
name: "rhs"
}
}
}
}
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "Op: {0}"
}
}
fields {
operator {
op: Mod
arguments {
identifier {
name: "lhs"
}
}
arguments {
identifier {
name: "rhs"
}
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -29,7 +31,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
fields {
binding_pattern {
@@ -76,7 +80,9 @@ compilation_unit {
}
members {
function {
name: "GetX"
name {
name: "GetX"
}
self_pattern {
binding_pattern {
name: "self"
@@ -166,7 +172,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
alias {
name: "AB"
name {
name: "AB"
}
target {
struct_type_literal {
fields {
@@ -28,7 +30,9 @@ compilation_unit {
}
declarations {
alias {
name: "BA"
name {
name: "BA"
}
target {
struct_type_literal {
fields {
@@ -51,7 +55,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Create"
name {
name: "Create"
}
param_pattern {
fields {
binding_pattern {
@@ -135,7 +139,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "A"
name {
name: "A"
}
members {
let {
pattern {
@@ -21,7 +23,9 @@ compilation_unit {
}
members {
function {
name: "FA"
name {
name: "FA"
}
param_pattern {
}
return_term {
@@ -34,18 +38,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
interface {
name: "B"
name {
name: "B"
}
members {
let {
pattern {
@@ -61,7 +60,9 @@ compilation_unit {
}
members {
function {
name: "FB"
name {
name: "FB"
}
param_pattern {
}
return_term {
@@ -74,18 +75,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "C"
name {
name: "C"
}
members {
impl {
kind: InternalImpl
@@ -112,26 +108,18 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "TA"
}
}
rhs {
rewrite {
member_name: "TA"
replacement {
int_type_literal {
}
}
}
}
clauses {
equals {
lhs {
designator {
name: "TB"
}
}
rhs {
rewrite {
member_name: "TB"
replacement {
int_type_literal {
}
}
@@ -141,7 +129,9 @@ compilation_unit {
}
members {
function {
name: "FA"
name {
name: "FA"
}
param_pattern {
}
return_term {
@@ -227,7 +217,9 @@ compilation_unit {
}
members {
function {
name: "FB"
name {
name: "FB"
}
param_pattern {
}
return_term {
@@ -395,7 +387,9 @@ compilation_unit {
}
members {
function {
name: "FB"
name {
name: "FB"
}
param_pattern {
}
return_term {
@@ -421,7 +415,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
variable {
binding {
@@ -25,7 +27,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
File diff suppressed because it is too large Load Diff
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,191 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
statements {
if_statement {
condition {
operator {
op: Eq
arguments {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
arguments {
int_literal {
value: 3
}
}
}
}
then_block {
statements {
return_expression_statement {
is_omitted_expression: true
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A: This message should not printed"
}
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 3
}
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
}
return_term {
@@ -81,7 +85,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -100,20 +106,8 @@ compilation_unit {
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "Point"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
identifier {
name: "Point"
}
}
}
@@ -144,8 +138,13 @@ compilation_unit {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
simple_member_access {
field: "x"
object {
identifier {
name: "p"
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,148 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "TypeLike"
}
members {
impl {
kind: InternalImpl
impl_type {
identifier {
name: "Self"
}
}
interface {
call {
function {
identifier {
name: "ImplicitAs"
}
}
argument {
tuple_literal {
fields {
type_type_literal {
}
}
}
}
}
}
members {
function {
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
type_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
members {
function {
name {
name: "Make"
}
param_pattern {
}
return_term {
kind: Expression
type {
identifier {
name: "Self"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
call {
function {
simple_member_access {
field: "Make"
object {
identifier {
name: "TypeLike"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -0,0 +1,434 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "ident"
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
bool_type_literal {
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
bool_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
identifier {
name: "x"
}
}
}
}
}
}
}
declarations {
function {
name {
name: "ident_i32"
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
identifier {
name: "x"
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "i"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
int_literal {
value: 0
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "d"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 4
}
}
}
}
}
is_returned: false
}
}
statements {
if_statement {
condition {
call {
function {
identifier {
name: "ident"
}
}
argument {
tuple_literal {
fields {
bool_literal {
value: true
}
}
}
}
}
}
then_block {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 3
}
}
}
}
}
is_returned: false
}
}
statements {
if_statement {
condition {
bool_literal {
value: true
}
}
then_block {
statements {
variable_definition {
pattern {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 2
}
}
}
}
}
is_returned: false
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "ident_i32"
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 2
}
}
}
}
}
}
}
}
statements {
if_statement {
condition {
operator {
op: Eq
arguments {
call {
function {
identifier {
name: "ident_i32"
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 0
}
}
}
}
}
}
arguments {
int_literal {
value: 0
}
}
}
}
then_block {
statements {
variable_definition {
pattern {
binding_pattern {
name: "c"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 1
}
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 2
}
}
}
}
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
}
return_term {
@@ -49,7 +53,9 @@ compilation_unit {
}
members {
function {
name: "GetX"
name {
name: "GetX"
}
self_pattern {
binding_pattern {
name: "self"
@@ -93,7 +99,9 @@ compilation_unit {
}
members {
function {
name: "GetXY"
name {
name: "GetXY"
}
self_pattern {
binding_pattern {
name: "self"
@@ -199,7 +207,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
variable {
binding {
@@ -37,7 +39,7 @@ compilation_unit {
call {
function {
identifier {
name: "SubWith"
name: "AddWith"
}
}
argument {
@@ -51,13 +53,9 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "Result"
}
}
rhs {
rewrite {
member_name: "Result"
replacement {
identifier {
name: "A"
}
@@ -68,7 +66,9 @@ compilation_unit {
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -115,7 +115,7 @@ compilation_unit {
name: "n"
expression {
operator {
op: Sub
op: Add
arguments {
simple_member_access {
field: "n"
@@ -145,7 +145,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -196,7 +198,7 @@ compilation_unit {
}
rhs {
operator {
op: Sub
op: Add
arguments {
identifier {
name: "a"
@@ -209,6 +211,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -70,6 +72,7 @@ compilation_unit {
value: 1
}
}
op: Plain
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "f"
name {
name: "f"
}
param_pattern {
}
return_term {
@@ -58,7 +60,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,211 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "Iface"
}
members {
let {
pattern {
generic_binding {
name: "N"
type {
int_type_literal {
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "F"
}
param_pattern {
fields {
generic_binding {
name: "T"
type {
where {
base {
identifier {
name: "Iface"
}
}
clauses {
equals {
lhs {
designator {
name: "N"
}
}
rhs {
int_literal {
value: 5
}
}
}
}
}
}
}
}
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
class_declaration {
name {
name: "Good"
}
}
}
declarations {
class_declaration {
name {
name: "Bad"
}
}
}
declarations {
impl {
kind: ExternalImpl
impl_type {
identifier {
name: "Good"
}
}
interface {
where {
base {
identifier {
name: "Iface"
}
}
clauses {
rewrite {
member_name: "N"
replacement {
int_literal {
value: 5
}
}
}
}
}
}
}
}
declarations {
impl {
kind: ExternalImpl
impl_type {
identifier {
name: "Bad"
}
}
interface {
where {
base {
identifier {
name: "Iface"
}
}
clauses {
rewrite {
member_name: "N"
replacement {
int_literal {
value: 4
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "Good"
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "Bad"
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -25,7 +25,9 @@ compilation_unit {
}
declarations {
function {
name: "ReturnTrue"
name {
name: "ReturnTrue"
}
param_pattern {
}
return_term {
@@ -58,6 +60,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -74,7 +77,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,48 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
qualifiers: "N"
name: "F"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Addable"
name {
name: "Addable"
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -48,13 +52,6 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
@@ -71,7 +68,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -136,7 +135,9 @@ compilation_unit {
}
declarations {
class_declaration {
name: "Class"
name {
name: "Class"
}
members {
variable {
binding {
@@ -156,7 +157,9 @@ compilation_unit {
}
declarations {
class_declaration {
name: "GenericClass"
name {
name: "GenericClass"
}
members {
variable {
binding {
@@ -175,7 +178,9 @@ compilation_unit {
}
members {
function {
name: "Get"
name {
name: "Get"
}
self_pattern {
binding_pattern {
name: "self"
@@ -265,7 +270,9 @@ compilation_unit {
}
declarations {
alias {
name: "ClassAlias"
name {
name: "ClassAlias"
}
target {
identifier {
name: "Class"
@@ -275,7 +282,9 @@ compilation_unit {
}
declarations {
alias {
name: "GenericClassAlias"
name {
name: "GenericClassAlias"
}
target {
identifier {
name: "GenericClass"
@@ -285,7 +294,9 @@ compilation_unit {
}
declarations {
alias {
name: "ClassSpecializationAlias"
name {
name: "ClassSpecializationAlias"
}
target {
call {
function {
@@ -307,7 +318,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "LazyNe"
name {
name: "LazyNe"
}
members {
variable {
binding {
@@ -63,7 +65,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -92,28 +96,23 @@ compilation_unit {
return_expression_statement {
expression {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
simple_member_access {
field: "v1"
object {
identifier {
name: "self"
}
}
simple_member_access {
field: "v1"
object {
identifier {
name: "self"
}
}
arguments {
simple_member_access {
field: "v2"
object {
identifier {
name: "self"
}
}
}
}
arguments {
simple_member_access {
field: "v2"
object {
identifier {
name: "self"
}
}
}
@@ -129,7 +128,9 @@ compilation_unit {
}
members {
function {
name: "Make"
name {
name: "Make"
}
param_pattern {
fields {
binding_pattern {
@@ -198,7 +199,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -281,6 +284,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
}
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Number"
name {
name: "Number"
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -23,7 +27,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -64,18 +70,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
variable {
binding {
@@ -136,7 +137,9 @@ compilation_unit {
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -161,7 +164,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -250,7 +255,9 @@ compilation_unit {
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -330,7 +337,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -496,7 +505,9 @@ compilation_unit {
}
declarations {
function {
name: "Sum"
name {
name: "Sum"
}
deduced_parameters {
name: "E"
type {
@@ -611,6 +622,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -643,6 +655,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -659,7 +672,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Frob"
name {
name: "Frob"
}
members {
let {
pattern {
@@ -21,7 +23,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
self_pattern {
binding_pattern {
name: "self"
@@ -48,18 +52,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
function {
name: "Use"
name {
name: "Use"
}
deduced_parameters {
name: "T"
type {
@@ -167,13 +166,9 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "Result"
}
}
rhs {
rewrite {
member_name: "Result"
replacement {
int_type_literal {
}
}
@@ -183,7 +178,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
self_pattern {
binding_pattern {
name: "self"
@@ -224,7 +221,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
variable {
binding {
@@ -51,13 +53,9 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "Result"
}
}
rhs {
rewrite {
member_name: "Result"
replacement {
identifier {
name: "A"
}
@@ -68,7 +66,9 @@ compilation_unit {
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -145,7 +145,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -209,6 +211,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -0,0 +1,142 @@
compilation_unit {
package_statement {
package_name: "EmptyIdentifier"
}
is_api: false
declarations {
function {
name {
name: "apply"
}
deduced_parameters {
name: "T"
type {
type_type_literal {
}
}
}
deduced_parameters {
name: "U"
type {
type_type_literal {
}
}
}
param_pattern {
fields {
binding_pattern {
name: "f"
type {
expression_pattern {
expression {
identifier {
name: "T"
}
}
}
}
}
}
fields {
binding_pattern {
name: "EmptyIdentifier"
type {
expression_pattern {
expression {
identifier {
name: "U"
}
}
}
}
}
}
}
return_term {
kind: Omitted
}
body {
statements {
match {
expression {
index {
object {
bool_literal {
value: true
}
}
offset {
bool_literal {
value: true
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "EmptyIdentifier"
}
param_pattern {
}
return_term {
kind: Expression
type {
call {
function {
identifier {
name: "apply"
}
}
argument {
tuple_literal {
fields {
bool_literal {
value: true
}
}
fields {
bool_literal {
value: true
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
variable {
binding {
@@ -50,7 +52,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -96,7 +100,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
variable {
binding {
@@ -39,13 +41,9 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "Result"
}
}
rhs {
rewrite {
member_name: "Result"
replacement {
identifier {
name: "A"
}
@@ -56,7 +54,9 @@ compilation_unit {
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -115,7 +115,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -174,6 +176,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "identFn"
name {
name: "identFn"
}
param_pattern {
fields {
binding_pattern {
@@ -43,7 +45,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -91,20 +95,15 @@ compilation_unit {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
}
@@ -154,26 +153,22 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 0
}
}
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 0
}
}
}
@@ -253,26 +248,22 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
}
@@ -335,26 +326,22 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 0
}
}
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 0
}
}
}
@@ -399,29 +386,25 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
identifier {
name: "x"
}
}
arguments {
operator {
op: Eq
op: Neg
arguments {
identifier {
name: "x"
}
}
arguments {
operator {
op: Neg
arguments {
int_literal {
value: 1
}
}
int_literal {
value: 1
}
}
}
@@ -468,26 +451,22 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
operator {
op: Eq
arguments {
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
identifier {
name: "x"
}
}
arguments {
int_literal {
value: 1
}
}
}
@@ -550,29 +529,25 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
if_statement {
condition {
operator {
op: Not
op: NotEq
arguments {
identifier {
name: "x"
}
}
arguments {
operator {
op: Eq
op: Neg
arguments {
identifier {
name: "x"
}
}
arguments {
operator {
op: Neg
arguments {
int_literal {
value: 1
}
}
int_literal {
value: 1
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -89,6 +91,7 @@ compilation_unit {
value: 3
}
}
op: Plain
}
}
statements {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
alias {
name: "TypeAlias"
name {
name: "TypeAlias"
}
target {
int_type_literal {
}
@@ -14,7 +16,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Vector"
name {
name: "Vector"
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -51,7 +55,9 @@ compilation_unit {
}
members {
function {
name: "Scale"
name {
name: "Scale"
}
self_pattern {
binding_pattern {
name: "self"
@@ -91,18 +97,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
variable {
binding {
@@ -150,7 +151,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -259,7 +262,9 @@ compilation_unit {
}
members {
function {
name: "Scale"
name {
name: "Scale"
}
self_pattern {
binding_pattern {
name: "self"
@@ -359,7 +364,9 @@ compilation_unit {
}
declarations {
function {
name: "AddAndScaleGeneric"
name {
name: "AddAndScaleGeneric"
}
deduced_parameters {
name: "T"
type {
@@ -508,7 +515,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,127 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "C"
}
members {
function {
name {
name: "Create"
}
param_pattern {
}
return_term {
kind: Expression
type {
identifier {
name: "Self"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
fields {
name: "a"
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "a"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "c"
type {
expression_pattern {
expression {
identifier {
name: "C"
}
}
}
}
}
}
init {
call {
function {
simple_member_access {
field: "Create"
object {
identifier {
name: "C"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,512 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "ManyTypes"
}
members {
let {
pattern {
generic_binding {
name: "T0"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T1"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T2"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T3"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T4"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T5"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T6"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T7"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T8"
type {
type_type_literal {
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "T9"
type {
type_type_literal {
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "F"
}
deduced_parameters {
name: "M"
type {
where {
base {
identifier {
name: "ManyTypes"
}
}
clauses {
rewrite {
member_name: "T0"
replacement {
designator {
name: "T1"
}
}
}
}
clauses {
rewrite {
member_name: "T1"
replacement {
designator {
name: "T2"
}
}
}
}
clauses {
rewrite {
member_name: "T2"
replacement {
designator {
name: "T3"
}
}
}
}
clauses {
rewrite {
member_name: "T3"
replacement {
designator {
name: "T4"
}
}
}
}
clauses {
rewrite {
member_name: "T4"
replacement {
designator {
name: "T5"
}
}
}
}
clauses {
rewrite {
member_name: "T5"
replacement {
designator {
name: "T6"
}
}
}
}
clauses {
rewrite {
member_name: "T6"
replacement {
designator {
name: "T7"
}
}
}
}
clauses {
rewrite {
member_name: "T7"
replacement {
designator {
name: "T8"
}
}
}
}
clauses {
rewrite {
member_name: "T8"
replacement {
designator {
name: "T9"
}
}
}
}
clauses {
rewrite {
member_name: "T9"
replacement {
int_type_literal {
}
}
}
}
}
}
}
param_pattern {
fields {
binding_pattern {
name: "m"
type {
expression_pattern {
expression {
identifier {
name: "M"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "v"
type {
expression_pattern {
expression {
simple_member_access {
field: "T0"
object {
identifier {
name: "M"
}
}
}
}
}
}
}
}
init {
int_literal {
value: 1
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
identifier {
name: "v"
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "C"
}
members {
impl {
kind: InternalImpl
impl_type {
identifier {
name: "Self"
}
}
interface {
where {
base {
identifier {
name: "ManyTypes"
}
}
clauses {
rewrite {
member_name: "T0"
replacement {
int_type_literal {
}
}
}
}
clauses {
rewrite {
member_name: "T1"
replacement {
designator {
name: "T0"
}
}
}
}
clauses {
rewrite {
member_name: "T2"
replacement {
designator {
name: "T1"
}
}
}
}
clauses {
rewrite {
member_name: "T3"
replacement {
designator {
name: "T2"
}
}
}
}
clauses {
rewrite {
member_name: "T4"
replacement {
designator {
name: "T3"
}
}
}
}
clauses {
rewrite {
member_name: "T5"
replacement {
designator {
name: "T4"
}
}
}
}
clauses {
rewrite {
member_name: "T6"
replacement {
designator {
name: "T5"
}
}
}
}
clauses {
rewrite {
member_name: "T7"
replacement {
designator {
name: "T6"
}
}
}
}
clauses {
rewrite {
member_name: "T8"
replacement {
designator {
name: "T7"
}
}
}
}
clauses {
rewrite {
member_name: "T9"
replacement {
designator {
name: "T8"
}
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "c"
type {
expression_pattern {
expression {
identifier {
name: "C"
}
}
}
}
}
}
init {
struct_literal {
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "c"
}
}
}
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,76 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
namespace {
name {
name: "N"
}
}
}
declarations {
function {
name {
qualifiers: "N"
name: "F"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "AddInt"
name {
name: "AddInt"
}
param_pattern {
fields {
binding_pattern {
@@ -138,7 +140,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "id"
name {
name: "id"
}
deduced_parameters {
name: "T"
type {
@@ -62,7 +64,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,70 +5,35 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "C"
}
members {
function {
name: "Origin"
name {
name: "Method1"
}
param_pattern {
fields {
binding_pattern {
name: "zero"
type {
expression_pattern {
expression {
identifier {
name: "T"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
call {
function {
identifier {
name: "Point"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "T"
}
}
fields {
identifier {
name: "T"
}
}
}
}
}
}
kind: Omitted
}
body {
statements {
return_expression_statement {
expression_statement {
expression {
struct_literal {
fields {
name: "x"
expression {
identifier {
name: "zero"
}
call {
function {
identifier {
name: "Print"
}
}
fields {
name: "y"
expression {
identifier {
name: "zero"
argument {
tuple_literal {
fields {
string_literal {
value: "Class C"
}
}
}
}
@@ -81,33 +46,17 @@ compilation_unit {
}
members {
function {
name: "GetX"
name {
name: "GetValue"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "Point"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "T"
}
}
fields {
identifier {
name: "T"
}
}
}
}
identifier {
name: "Self"
}
}
}
@@ -119,8 +68,7 @@ compilation_unit {
return_term {
kind: Expression
type {
identifier {
name: "T"
int_type_literal {
}
}
}
@@ -129,7 +77,7 @@ compilation_unit {
return_expression_statement {
expression {
simple_member_access {
field: "x"
field: "value"
object {
identifier {
name: "self"
@@ -145,12 +93,54 @@ compilation_unit {
members {
variable {
binding {
name: "x"
name: "value"
type {
expression_pattern {
expression {
identifier {
name: "T"
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "D"
}
members {
function {
name {
name: "Method1"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "Class D"
}
}
}
}
}
}
}
@@ -161,12 +151,11 @@ compilation_unit {
members {
variable {
binding {
name: "y"
name: "value"
type {
expression_pattern {
expression {
identifier {
name: "T"
int_type_literal {
}
}
}
@@ -174,22 +163,13 @@ compilation_unit {
}
}
}
type_params {
fields {
generic_binding {
name: "T"
type {
type_type_literal {
}
}
}
}
}
}
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -204,24 +184,12 @@ compilation_unit {
variable_definition {
pattern {
binding_pattern {
name: "p"
name: "d"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "Point"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
identifier {
name: "D"
}
}
}
@@ -229,34 +197,26 @@ compilation_unit {
}
}
init {
call {
function {
simple_member_access {
field: "Origin"
object {
call {
function {
identifier {
name: "Point"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
struct_literal {
fields {
name: "value"
expression {
int_literal {
value: 2
}
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 0
fields {
name: "base"
expression {
struct_literal {
fields {
name: "value"
expression {
int_literal {
value: 1
}
}
}
}
}
@@ -267,15 +227,15 @@ compilation_unit {
}
}
statements {
return_expression_statement {
expression_statement {
expression {
call {
function {
simple_member_access {
field: "GetX"
field: "Method1"
object {
identifier {
name: "p"
name: "d"
}
}
}
@@ -288,6 +248,87 @@ compilation_unit {
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "d.value = {0}"
}
}
fields {
simple_member_access {
field: "value"
object {
identifier {
name: "d"
}
}
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "d.GetValue() = {0}"
}
}
fields {
call {
function {
simple_member_access {
field: "GetValue"
object {
identifier {
name: "d"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Foo"
name {
name: "Foo"
}
param_pattern {
fields {
binding_pattern {
@@ -111,6 +113,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -142,6 +145,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -153,7 +157,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,92 @@
compilation_unit {
package_statement {
package_name: "EmptyIdentifier"
}
is_api: false
declarations {
function {
name {
name: "test"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "test"
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
init {
int_literal {
value: 1
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "MyAddWith"
name {
name: "MyAddWith"
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -49,18 +53,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
variable {
binding {
@@ -121,7 +120,9 @@ compilation_unit {
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -232,7 +233,9 @@ compilation_unit {
}
declarations {
function {
name: "DoAddGeneric"
name {
name: "DoAddGeneric"
}
deduced_parameters {
name: "T"
type {
@@ -332,7 +335,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Bad"
name {
name: "Bad"
}
deduced_parameters {
name: "T"
type {
@@ -52,7 +54,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,128 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "Foo"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
tuple_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
fields {
binding_pattern {
name: "y"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
is_returned: false
}
}
statements {
while_statement {
condition {
operator {
op: Eq
arguments {
call {
function {
identifier {
name: "Foo"
}
}
argument {
tuple_literal {
}
}
}
}
arguments {
int_literal {
value: 0
}
}
}
}
body {
statements {
assign {
lhs {
identifier {
name: "y"
}
}
rhs {
identifier {
name: "x"
}
}
op: Plain
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
@@ -0,0 +1,69 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "C"
}
}
}
declarations {
function {
name {
name: "F"
}
deduced_parameters {
name: "T"
type {
operator {
op: BitwiseAnd
arguments {
type_type_literal {
}
}
arguments {
identifier {
name: "C"
}
}
}
}
}
param_pattern {
}
return_term {
kind: Omitted
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -0,0 +1,151 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "t1"
type {
expression_pattern {
expression {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
init {
tuple_literal {
fields {
int_literal {
value: 5
}
}
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "t2"
type {
expression_pattern {
expression {
tuple_literal {
fields {
int_type_literal {
}
}
fields {
int_type_literal {
}
}
}
}
}
}
}
}
init {
tuple_literal {
fields {
int_literal {
value: 2
}
}
fields {
int_literal {
value: 3
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
operator {
op: Sub
arguments {
operator {
op: Sub
arguments {
index {
object {
identifier {
name: "t1"
}
}
offset {
int_literal {
value: 0
}
}
}
}
arguments {
index {
object {
identifier {
name: "t2"
}
}
offset {
int_literal {
value: 0
}
}
}
}
}
}
arguments {
index {
object {
identifier {
name: "t2"
}
}
offset {
int_literal {
value: 1
}
}
}
}
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "One"
name {
name: "One"
}
members {
impl {
kind: InternalImpl
@@ -33,7 +35,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -76,7 +80,9 @@ compilation_unit {
}
declarations {
class_declaration {
name: "Two"
name {
name: "Two"
}
members {
impl {
kind: InternalImpl
@@ -104,7 +110,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -147,7 +155,9 @@ compilation_unit {
}
declarations {
class_declaration {
name: "N"
name {
name: "N"
}
members {
impl {
kind: InternalImpl
@@ -175,7 +185,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -238,7 +250,9 @@ compilation_unit {
}
declarations {
function {
name: "Get"
name {
name: "Get"
}
param_pattern {
fields {
binding_pattern {
@@ -342,7 +356,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -370,7 +386,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -393,7 +409,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "A"
name {
name: "A"
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -20,21 +24,18 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
interface {
name: "B"
name {
name: "B"
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -46,13 +47,6 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
@@ -69,7 +63,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -108,7 +104,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
param_pattern {
}
return_term {
@@ -135,7 +133,9 @@ compilation_unit {
}
declarations {
function {
name: "GetA"
name {
name: "GetA"
}
deduced_parameters {
name: "T"
type {
@@ -195,7 +195,9 @@ compilation_unit {
}
declarations {
function {
name: "GetAB"
name {
name: "GetAB"
}
deduced_parameters {
name: "T"
type {
@@ -306,7 +308,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,414 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
members {
function {
name {
name: "FunctionA"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
members {
variable {
binding {
name: "a"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
members {
variable {
binding {
name: "aa"
type {
expression_pattern {
expression {
string_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "B"
}
members {
function {
name {
name: "FunctionB"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
members {
variable {
binding {
name: "b"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "C"
}
members {
function {
name {
name: "FunctionC"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
members {
variable {
binding {
name: "c"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "c"
type {
expression_pattern {
expression {
identifier {
name: "C"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "base"
expression {
struct_literal {
fields {
name: "base"
expression {
struct_literal {
fields {
name: "aa"
expression {
string_literal {
value: "A"
}
}
}
fields {
name: "a"
expression {
int_literal {
value: 1
}
}
}
}
}
}
fields {
name: "b"
expression {
int_literal {
value: 2
}
}
}
}
}
}
fields {
name: "c"
expression {
int_literal {
value: 3
}
}
}
}
}
is_returned: false
}
}
statements {
expression_statement {
expression {
call {
function {
simple_member_access {
field: "FunctionA"
object {
identifier {
name: "c"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
simple_member_access {
field: "FunctionB"
object {
identifier {
name: "c"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
simple_member_access {
field: "FunctionC"
object {
identifier {
name: "c"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
simple_member_access {
field: "aa"
object {
identifier {
name: "c"
}
}
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "c.a: {0}"
}
}
fields {
simple_member_access {
field: "a"
object {
identifier {
name: "c"
}
}
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "c.b: {0}"
}
}
fields {
simple_member_access {
field: "b"
object {
identifier {
name: "c"
}
}
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "c.c: {0}"
}
}
fields {
simple_member_access {
field: "c"
object {
identifier {
name: "c"
}
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "IntDiff"
name {
name: "IntDiff"
}
param_pattern {
fields {
binding_pattern {
@@ -144,7 +146,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,265 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "HasAssoc"
}
members {
let {
pattern {
generic_binding {
name: "Assoc"
type {
type_type_literal {
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "X"
}
members {
impl {
kind: ExternalImpl
impl_type {
identifier {
name: "Self"
}
}
interface {
where {
base {
identifier {
name: "HasAssoc"
}
}
clauses {
rewrite {
member_name: "Assoc"
replacement {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
declarations {
alias {
name {
name: "WithoutRewrite"
}
target {
where {
base {
identifier {
name: "HasAssoc"
}
}
clauses {
equals {
lhs {
designator {
name: "Assoc"
}
}
rhs {
int_type_literal {
}
}
}
}
}
}
}
}
declarations {
alias {
name {
name: "WithRewrite"
}
target {
where {
base {
identifier {
name: "HasAssoc"
}
}
clauses {
rewrite {
member_name: "Assoc"
replacement {
int_type_literal {
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "F"
}
deduced_parameters {
name: "T"
type {
identifier {
name: "WithRewrite"
}
}
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
identifier {
name: "T"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
compound_member_access {
object {
identifier {
name: "T"
}
}
path {
simple_member_access {
field: "Assoc"
object {
identifier {
name: "WithoutRewrite"
}
}
}
}
}
}
}
}
}
}
init {
int_literal {
value: 1
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
identifier {
name: "a"
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
identifier {
name: "X"
}
}
}
}
}
}
init {
struct_literal {
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "x"
}
}
}
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,184 @@
compilation_unit {
package_statement {
package_name: "Foo"
}
is_api: true
declarations {
class_declaration {
name {
name: "X"
}
members {
function {
name {
name: "F"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
fields {
binding_pattern {
name: "o"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
identifier {
name: "Self"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
fields {
name: "n"
expression {
operator {
op: Add
arguments {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
arguments {
simple_member_access {
field: "n"
object {
identifier {
name: "o"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
simple_member_access {
field: "n"
object {
call {
function {
compound_member_access {
object {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 1
}
}
}
}
}
path {
simple_member_access {
field: "F"
object {
identifier {
name: "X"
}
}
}
}
}
}
argument {
tuple_literal {
fields {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 2
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
fields {
binding_pattern {
@@ -63,7 +67,9 @@ compilation_unit {
}
members {
function {
name: "GetX"
name {
name: "GetX"
}
self_pattern {
binding_pattern {
name: "self"
@@ -153,7 +159,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
variable {
binding {
@@ -53,7 +55,9 @@ compilation_unit {
}
declarations {
function {
name: "FirstOfTwoPoints"
name {
name: "FirstOfTwoPoints"
}
deduced_parameters {
name: "T"
type {
@@ -153,7 +157,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,172 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "Optional"
}
}
argument {
tuple_literal {
fields {
string_type_literal {
}
}
}
}
}
}
}
}
}
}
init {
call {
function {
simple_member_access {
field: "Create"
object {
call {
function {
identifier {
name: "Optional"
}
}
argument {
tuple_literal {
fields {
string_type_literal {
}
}
}
}
}
}
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "Hallo Welt"
}
}
}
}
}
}
is_returned: false
}
}
statements {
if_statement {
condition {
call {
function {
simple_member_access {
field: "HasValue"
object {
identifier {
name: "x"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
then_block {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
call {
function {
simple_member_access {
field: "Get"
object {
identifier {
name: "x"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
operator {
op: Neg
arguments {
int_literal {
value: 1
}
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,361 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
members {
class_declaration {
name {
name: "B"
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR B {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
function {
name {
name: "Create"
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
identifier {
name: "B"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
fields {
name: "n"
expression {
identifier {
name: "x"
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
function {
name {
name: "Create"
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
identifier {
name: "A"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
fields {
name: "n"
expression {
identifier {
name: "x"
}
}
}
fields {
name: "b"
expression {
call {
function {
simple_member_access {
field: "Create"
object {
identifier {
name: "B"
}
}
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 2
}
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
members {
variable {
binding {
name: "b"
type {
expression_pattern {
expression {
identifier {
name: "B"
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
call {
function {
simple_member_access {
field: "Create"
object {
identifier {
name: "A"
}
}
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 1
}
}
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,323 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "Runnable"
}
members {
function {
name {
name: "Run"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
}
}
}
}
declarations {
interface {
name {
name: "Walkable"
}
members {
function {
name {
name: "Walk"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
}
}
}
}
declarations {
constraint {
name {
name: "Traversible"
}
members {
interface_extends {
base {
identifier {
name: "Runnable"
}
}
}
}
members {
interface_extends {
base {
identifier {
name: "Walkable"
}
}
}
}
}
}
declarations {
impl {
kind: ExternalImpl
impl_type {
int_type_literal {
}
}
interface {
identifier {
name: "Traversible"
}
}
members {
function {
name {
name: "Run"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
operator {
op: Mul
arguments {
int_literal {
value: 10
}
}
arguments {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
members {
function {
name {
name: "Walk"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
operator {
op: Add
arguments {
identifier {
name: "self"
}
}
arguments {
int_literal {
value: 1
}
}
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
int_literal {
value: 1
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
operator {
op: Add
arguments {
call {
function {
compound_member_access {
object {
identifier {
name: "n"
}
}
path {
simple_member_access {
field: "Run"
object {
identifier {
name: "Runnable"
}
}
}
}
}
}
argument {
tuple_literal {
}
}
}
}
arguments {
call {
function {
compound_member_access {
object {
identifier {
name: "n"
}
}
path {
simple_member_access {
field: "Walk"
object {
identifier {
name: "Walkable"
}
}
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
}
}
@@ -45,7 +45,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,89 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
int_literal {
value: 0
}
}
is_returned: false
}
}
statements {
match {
expression {
identifier {
name: "n"
}
}
clauses {
pattern {
expression_pattern {
expression {
int_literal {
value: 1
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
@@ -0,0 +1,404 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "MyHashable"
}
members {
let {
pattern {
generic_binding {
name: "Result"
type {
type_type_literal {
}
}
}
}
}
}
members {
function {
name {
name: "Hash"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
identifier {
name: "Result"
}
}
}
}
}
}
}
declarations {
constraint {
name {
name: "HashToIntConvertible"
}
members {
interface_impl {
impl_type {
identifier {
name: "Self"
}
}
constraint {
identifier {
name: "MyHashable"
}
}
}
}
members {
interface_impl {
impl_type {
compound_member_access {
object {
identifier {
name: "Self"
}
}
path {
simple_member_access {
field: "Result"
object {
identifier {
name: "MyHashable"
}
}
}
}
}
}
constraint {
call {
function {
identifier {
name: "ImplicitAs"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "MyHashValue"
}
members {
impl {
kind: ExternalImpl
impl_type {
identifier {
name: "Self"
}
}
interface {
call {
function {
identifier {
name: "ImplicitAs"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
members {
function {
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 4
}
}
}
}
}
}
}
}
}
}
}
declarations {
class_declaration {
name {
name: "Widget"
}
members {
impl {
kind: ExternalImpl
impl_type {
identifier {
name: "Self"
}
}
interface {
where {
base {
identifier {
name: "MyHashable"
}
}
clauses {
rewrite {
member_name: "Result"
replacement {
identifier {
name: "MyHashValue"
}
}
}
}
}
}
members {
function {
name {
name: "Hash"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
identifier {
name: "MyHashValue"
}
}
}
body {
statements {
return_expression_statement {
expression {
struct_literal {
}
}
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "MakeSmallHash"
}
deduced_parameters {
name: "T"
type {
identifier {
name: "HashToIntConvertible"
}
}
}
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 {
compound_member_access {
object {
identifier {
name: "x"
}
}
path {
simple_member_access {
field: "Hash"
object {
identifier {
name: "MyHashable"
}
}
}
}
}
}
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: "w"
type {
expression_pattern {
expression {
identifier {
name: "Widget"
}
}
}
}
}
}
init {
struct_literal {
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
call {
function {
identifier {
name: "MakeSmallHash"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "w"
}
}
}
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,190 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A1 {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
destructor {
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
body {
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "Print"
}
}
argument {
tuple_literal {
fields {
string_literal {
value: "DESTRUCTOR A2 {0}"
}
}
fields {
simple_member_access {
field: "n"
object {
identifier {
name: "self"
}
}
}
}
}
}
}
}
}
}
}
}
}
members {
variable {
binding {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "A"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "n"
expression {
int_literal {
value: 3
}
}
}
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 1
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
members {
impl {
kind: InternalImpl
@@ -33,7 +35,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -76,7 +80,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -104,7 +110,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Vector"
name {
name: "Vector"
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -23,7 +27,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -66,7 +72,9 @@ compilation_unit {
}
members {
function {
name: "Scale"
name {
name: "Scale"
}
self_pattern {
binding_pattern {
name: "self"
@@ -106,18 +114,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
variable {
binding {
@@ -190,7 +193,9 @@ compilation_unit {
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -243,7 +248,9 @@ compilation_unit {
}
members {
function {
name: "Add"
name {
name: "Add"
}
self_pattern {
binding_pattern {
name: "self"
@@ -388,7 +395,9 @@ compilation_unit {
}
members {
function {
name: "Scale"
name {
name: "Scale"
}
self_pattern {
binding_pattern {
name: "self"
@@ -512,7 +521,9 @@ compilation_unit {
}
declarations {
function {
name: "AddAndScaleGeneric"
name {
name: "AddAndScaleGeneric"
}
deduced_parameters {
name: "T"
type {
@@ -622,7 +633,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "SwizzleWith"
name {
name: "SwizzleWith"
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -48,18 +52,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
alias {
name: "Swizzle"
name {
name: "Swizzle"
}
target {
where {
base {
@@ -123,7 +122,9 @@ compilation_unit {
}
members {
function {
name: "Op"
name {
name: "Op"
}
self_pattern {
binding_pattern {
name: "self"
@@ -199,7 +200,9 @@ compilation_unit {
}
declarations {
function {
name: "F"
name {
name: "F"
}
deduced_parameters {
name: "T"
type {
@@ -300,7 +303,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "A"
name {
name: "A"
}
members {
function {
name: "F"
name {
name: "F"
}
self_pattern {
binding_pattern {
name: "self"
@@ -34,18 +38,13 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
class_declaration {
name: "X"
name {
name: "X"
}
members {
impl {
kind: InternalImpl
@@ -61,7 +60,9 @@ compilation_unit {
}
members {
function {
name: "F"
name {
name: "F"
}
self_pattern {
binding_pattern {
name: "self"
@@ -104,7 +105,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -132,7 +135,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -0,0 +1,62 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "F"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
function {
name {
qualifiers: "F"
name: "G"
}
param_pattern {
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -0,0 +1,413 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
type_params {
fields {
generic_binding {
name: "T"
type {
type_type_literal {
}
}
}
}
}
}
}
declarations {
interface {
name {
name: "B"
}
}
}
declarations {
match_first {
impls {
impl {
kind: ExternalImpl
impl_type {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
interface {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
impls {
impl {
kind: ExternalImpl
impl_type {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
interface {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "T"
}
}
}
}
}
}
}
}
}
}
declarations {
impl {
kind: ExternalImpl
impl_type {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "T"
}
}
}
}
}
}
interface {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "F"
}
deduced_parameters {
name: "T"
type {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
identifier {
name: "T"
}
}
}
}
}
}
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
function {
name {
name: "G"
}
deduced_parameters {
name: "T"
type {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
bool_type_literal {
}
}
}
}
}
}
}
param_pattern {
fields {
binding_pattern {
name: "x"
type {
expression_pattern {
expression {
identifier {
name: "T"
}
}
}
}
}
}
}
return_term {
kind: Omitted
}
body {
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
bool_type_literal {
}
}
}
}
}
}
}
}
}
}
init {
struct_literal {
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
init {
struct_literal {
}
}
is_returned: false
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "a"
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "G"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "b"
}
}
}
}
}
}
}
}
statements {
expression_statement {
expression {
call {
function {
identifier {
name: "F"
}
}
argument {
tuple_literal {
fields {
identifier {
name: "b"
}
}
}
}
}
}
}
}
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -0,0 +1,650 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
choice {
name {
name: "Opt"
}
alternatives {
name: "None"
signature {
}
}
alternatives {
name: "Some"
signature {
fields {
int_type_literal {
}
}
}
}
}
}
declarations {
function {
name {
name: "A"
}
param_pattern {
fields {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "Opt"
}
}
}
}
}
}
fields {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
identifier {
name: "Opt"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
match {
expression {
tuple_literal {
fields {
identifier {
name: "a"
}
}
fields {
identifier {
name: "b"
}
}
}
}
clauses {
pattern {
tuple_pattern {
fields {
alternative_pattern {
choice_type {
identifier {
name: "Opt"
}
}
alternative_name: "Some"
arguments {
fields {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
fields {
binding_pattern {
name: "_"
type {
auto_pattern {
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
identifier {
name: "n"
}
}
}
}
}
}
}
clauses {
pattern {
tuple_pattern {
fields {
binding_pattern {
name: "_"
type {
auto_pattern {
}
}
}
}
fields {
alternative_pattern {
choice_type {
identifier {
name: "Opt"
}
}
alternative_name: "Some"
arguments {
fields {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
identifier {
name: "n"
}
}
}
}
}
}
}
clauses {
pattern {
expression_pattern {
expression {
tuple_literal {
fields {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
fields {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "B"
}
param_pattern {
fields {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
identifier {
name: "Opt"
}
}
}
}
}
}
fields {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
identifier {
name: "Opt"
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
match {
expression {
tuple_literal {
fields {
identifier {
name: "a"
}
}
fields {
identifier {
name: "b"
}
}
}
}
clauses {
pattern {
tuple_pattern {
fields {
expression_pattern {
expression {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
fields {
binding_pattern {
name: "_"
type {
auto_pattern {
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
clauses {
pattern {
tuple_pattern {
fields {
alternative_pattern {
choice_type {
identifier {
name: "Opt"
}
}
alternative_name: "Some"
arguments {
fields {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
fields {
expression_pattern {
expression {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
identifier {
name: "n"
}
}
}
}
}
}
}
clauses {
pattern {
tuple_pattern {
fields {
alternative_pattern {
choice_type {
identifier {
name: "Opt"
}
}
alternative_name: "Some"
arguments {
fields {
binding_pattern {
name: "n"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
fields {
alternative_pattern {
choice_type {
identifier {
name: "Opt"
}
}
alternative_name: "Some"
arguments {
fields {
binding_pattern {
name: "m"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
}
}
statement {
block {
statements {
return_expression_statement {
expression {
operator {
op: Add
arguments {
identifier {
name: "n"
}
}
arguments {
identifier {
name: "m"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
operator {
op: Add
arguments {
call {
function {
identifier {
name: "A"
}
}
argument {
tuple_literal {
fields {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
fields {
call {
function {
simple_member_access {
field: "Some"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 1
}
}
}
}
}
}
}
}
}
}
arguments {
call {
function {
identifier {
name: "B"
}
}
argument {
tuple_literal {
fields {
call {
function {
simple_member_access {
field: "Some"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 2
}
}
}
}
}
}
fields {
call {
function {
simple_member_access {
field: "None"
object {
identifier {
name: "Opt"
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "Vector"
name {
name: "Vector"
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -20,13 +24,6 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
@@ -44,7 +41,9 @@ compilation_unit {
}
members {
function {
name: "Zero"
name {
name: "Zero"
}
param_pattern {
}
return_term {
@@ -71,7 +70,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
type_params {
fields {
generic_binding {
@@ -21,13 +23,8 @@ compilation_unit {
}
declarations {
interface {
name: "B"
self {
name: "Self"
type {
type_type_literal {
}
}
name {
name: "B"
}
}
}
@@ -113,7 +110,9 @@ compilation_unit {
}
declarations {
function {
name: "F"
name {
name: "F"
}
deduced_parameters {
name: "T"
type {
@@ -159,7 +158,9 @@ compilation_unit {
}
declarations {
function {
name: "G"
name {
name: "G"
}
deduced_parameters {
name: "T"
type {
@@ -205,7 +206,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -245,7 +248,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -280,7 +283,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Cell"
name {
name: "Cell"
}
members {
function {
name: "Create"
name {
name: "Create"
}
param_pattern {
fields {
binding_pattern {
@@ -68,7 +72,9 @@ compilation_unit {
}
members {
function {
name: "Get"
name {
name: "Get"
}
self_pattern {
binding_pattern {
name: "self"
@@ -113,7 +119,9 @@ compilation_unit {
}
members {
function {
name: "Put"
name {
name: "Put"
}
self_pattern {
addr_pattern {
binding_pattern {
@@ -177,6 +185,7 @@ compilation_unit {
name: "x"
}
}
op: Plain
}
}
}
@@ -184,7 +193,9 @@ compilation_unit {
}
members {
function {
name: "Update"
name {
name: "Update"
}
deduced_parameters {
name: "U"
type {
@@ -269,6 +280,7 @@ compilation_unit {
name: "x"
}
}
op: Plain
}
}
}
@@ -276,7 +288,9 @@ compilation_unit {
}
members {
function {
name: "CreateOther"
name {
name: "CreateOther"
}
deduced_parameters {
name: "U"
type {
@@ -386,7 +400,9 @@ compilation_unit {
}
declarations {
class_declaration {
name: "Integer"
name {
name: "Integer"
}
members {
variable {
binding {
@@ -406,7 +422,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -535,6 +553,7 @@ compilation_unit {
}
}
}
op: Plain
}
}
statements {
@@ -0,0 +1,132 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
function {
name {
name: "AddInt"
}
param_pattern {
fields {
binding_pattern {
name: "a"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
fields {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "ret"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
init {
operator {
op: Add
arguments {
identifier {
name: "a"
}
}
arguments {
identifier {
name: "b"
}
}
}
}
is_returned: true
}
}
statements {
return_var_statement {
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
call {
function {
identifier {
name: "AddInt"
}
}
argument {
tuple_literal {
fields {
int_literal {
value: 1
}
}
fields {
int_literal {
value: 2
}
}
}
}
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Add"
name {
name: "ComputeSum"
}
param_pattern {
fields {
binding_pattern {
@@ -41,7 +43,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -61,7 +65,7 @@ compilation_unit {
call {
function {
identifier {
name: "Add"
name: "ComputeSum"
}
}
argument {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "F"
name {
name: "F"
}
param_pattern {
fields {
binding_pattern {
@@ -56,7 +58,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,10 +5,14 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "Point"
name {
name: "Point"
}
members {
function {
name: "Origin"
name {
name: "Origin"
}
param_pattern {
fields {
binding_pattern {
@@ -31,7 +35,7 @@ compilation_unit {
call {
function {
identifier {
name: "Point"
name: "Self"
}
}
argument {
@@ -76,7 +80,9 @@ compilation_unit {
}
members {
function {
name: "GetX"
name {
name: "GetX"
}
self_pattern {
binding_pattern {
name: "self"
@@ -86,7 +92,7 @@ compilation_unit {
call {
function {
identifier {
name: "Point"
name: "Self"
}
}
argument {
@@ -179,7 +185,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,56 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "C"
}
members {
variable {
binding {
name: "m"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -0,0 +1,199 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "A"
}
}
}
declarations {
class_declaration {
name {
name: "B"
}
members {
function {
name {
name: "Foo"
}
self_pattern {
binding_pattern {
name: "self"
type {
expression_pattern {
expression {
identifier {
name: "Self"
}
}
}
}
}
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
variable_definition {
pattern {
binding_pattern {
name: "b"
type {
expression_pattern {
expression {
identifier {
name: "B"
}
}
}
}
}
}
init {
struct_literal {
fields {
name: "base"
expression {
struct_literal {
}
}
}
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "bp"
type {
expression_pattern {
expression {
operator {
op: Ptr
arguments {
identifier {
name: "B"
}
}
}
}
}
}
}
}
init {
operator {
op: AddressOf
arguments {
identifier {
name: "b"
}
}
}
}
is_returned: false
}
}
statements {
variable_definition {
pattern {
binding_pattern {
name: "ap"
type {
expression_pattern {
expression {
operator {
op: Ptr
arguments {
identifier {
name: "A"
}
}
}
}
}
}
}
}
init {
identifier {
name: "bp"
}
}
is_returned: false
}
}
statements {
return_expression_statement {
expression {
call {
function {
simple_member_access {
field: "Foo"
object {
operator {
op: Deref
arguments {
identifier {
name: "ap"
}
}
}
}
}
}
argument {
tuple_literal {
}
}
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
class_declaration {
name: "A"
name {
name: "A"
}
}
}
declarations {
@@ -35,7 +37,9 @@ compilation_unit {
}
members {
function {
name: "Convert"
name {
name: "Convert"
}
self_pattern {
binding_pattern {
name: "self"
@@ -76,7 +80,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -104,7 +110,7 @@ compilation_unit {
}
}
init {
struct_type_literal {
struct_literal {
}
}
is_returned: false
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "f"
name {
name: "f"
}
param_pattern {
fields {
binding_pattern {
@@ -66,7 +68,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
interface {
name: "HasThreeTypes"
name {
name: "HasThreeTypes"
}
members {
let {
pattern {
@@ -45,13 +47,6 @@ compilation_unit {
}
}
}
self {
name: "Self"
type {
type_type_literal {
}
}
}
}
}
declarations {
@@ -69,29 +64,22 @@ compilation_unit {
}
}
clauses {
equals {
lhs {
designator {
name: "A"
}
}
rhs {
rewrite {
member_name: "A"
replacement {
int_type_literal {
}
}
}
}
clauses {
equals {
lhs {
rewrite {
member_name: "B"
replacement {
designator {
name: "C"
}
}
rhs {
int_type_literal {
}
}
}
}
}
@@ -100,7 +88,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,70 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
class_declaration {
name {
name: "C"
}
members {
variable {
binding {
name: "x"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
members {
variable {
binding {
name: "y"
type {
expression_pattern {
expression {
int_type_literal {
}
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}
@@ -5,7 +5,9 @@ compilation_unit {
is_api: true
declarations {
function {
name: "AllocateInteger"
name {
name: "AllocateInteger"
}
param_pattern {
}
return_term {
@@ -53,7 +55,9 @@ compilation_unit {
}
declarations {
function {
name: "Main"
name {
name: "Main"
}
param_pattern {
}
return_term {
@@ -0,0 +1,75 @@
compilation_unit {
package_statement {
package_name: "ExplorerTest"
}
is_api: true
declarations {
interface {
name {
name: "Vector"
}
members {
function {
name {
name: "ScalarZero"
}
param_pattern {
}
return_term {
kind: Expression
type {
simple_member_access {
field: "ScalarType"
object {
identifier {
name: "Vector"
}
}
}
}
}
}
}
members {
let {
pattern {
generic_binding {
name: "ScalarType"
type {
type_type_literal {
}
}
}
}
}
}
}
}
declarations {
function {
name {
name: "Main"
}
param_pattern {
}
return_term {
kind: Expression
type {
int_type_literal {
}
}
}
body {
statements {
return_expression_statement {
expression {
int_literal {
value: 0
}
}
}
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More