mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Add syntax for package and library (#792)
Doesn't add much logic, only takes advantage of parser structure for the ordering enforcement. Note import_nonexistent tests should probably fail, but writing import tests needs a chain of functionality, and I figured I'd just start adding some to validate the syntax (not adding existent imports because that'd require multi-file structure).
This commit is contained in:
@@ -4,6 +4,15 @@
|
||||
|
||||
package(default_visibility = ["//executable_semantics:__subpackages__"])
|
||||
|
||||
cc_library(
|
||||
name = "ast",
|
||||
hdrs = ["ast.h"],
|
||||
deps = [
|
||||
":declaration",
|
||||
":library_name",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "class_definition",
|
||||
hdrs = ["class_definition.h"],
|
||||
@@ -19,7 +28,6 @@ cc_library(
|
||||
name = "declaration",
|
||||
srcs = ["declaration.cpp"],
|
||||
hdrs = [
|
||||
"abstract_syntax_tree.h",
|
||||
"declaration.h",
|
||||
],
|
||||
deps = [
|
||||
@@ -82,6 +90,11 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "library_name",
|
||||
hdrs = ["library_name.h"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "paren_contents",
|
||||
hdrs = ["paren_contents.h"],
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef EXECUTABLE_SEMANTICS_AST_ABSTRACT_SYNTAX_TREE_H_
|
||||
#define EXECUTABLE_SEMANTICS_AST_ABSTRACT_SYNTAX_TREE_H_
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "executable_semantics/ast/declaration.h"
|
||||
#include "executable_semantics/common/ptr.h"
|
||||
|
||||
namespace Carbon {
|
||||
using AST = std::list<Ptr<const Declaration>>;
|
||||
}
|
||||
|
||||
#endif // EXECUTABLE_SEMANTICS_AST_ABSTRACT_SYNTAX_TREE_H_
|
||||
@@ -0,0 +1,30 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef EXECUTABLE_SEMANTICS_AST_AST_H_
|
||||
#define EXECUTABLE_SEMANTICS_AST_AST_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "executable_semantics/ast/declaration.h"
|
||||
#include "executable_semantics/ast/library_name.h"
|
||||
#include "executable_semantics/common/ptr.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
// A Carbon file's AST.
|
||||
struct AST {
|
||||
// The package directive's library.
|
||||
LibraryName package;
|
||||
// The package directive's API or impl state.
|
||||
bool is_api;
|
||||
// Import directives.
|
||||
std::vector<LibraryName> imports;
|
||||
// The file's ordered declarations.
|
||||
std::list<Ptr<const Declaration>> declarations;
|
||||
};
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
#endif // EXECUTABLE_SEMANTICS_AST_AST_H_
|
||||
@@ -0,0 +1,25 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef EXECUTABLE_SEMANTICS_AST_LIBRARY_NAME_H_
|
||||
#define EXECUTABLE_SEMANTICS_AST_LIBRARY_NAME_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
// Identifies a particular library. For example, "Geometry//Objects/FourSides"
|
||||
// will have package="Geometry" and path="Objects/FourSides".
|
||||
struct LibraryName {
|
||||
// The library's package.
|
||||
std::string package;
|
||||
|
||||
// The package-relative path of the library. This defaults to the empty
|
||||
// string.
|
||||
std::string path;
|
||||
};
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
#endif // EXECUTABLE_SEMANTICS_AST_LIBRARY_NAME_H_
|
||||
@@ -43,6 +43,7 @@ cc_library(
|
||||
deps = [
|
||||
":interpreter",
|
||||
":type_checker",
|
||||
"//executable_semantics/ast",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Carbon {
|
||||
|
||||
// Adds builtins, currently only Print(). Note Print() is experimental, not
|
||||
// standardized, but is made available for printing state in tests.
|
||||
static void AddIntrinsics(std::list<Ptr<const Declaration>>* fs) {
|
||||
static void AddIntrinsics(std::list<Ptr<const Declaration>>* declarations) {
|
||||
SourceLocation loc("<intrinsic>", 0);
|
||||
std::vector<TuplePattern::Field> print_fields = {TuplePattern::Field(
|
||||
"0", global_arena->New<BindingPattern>(
|
||||
@@ -34,24 +34,24 @@ static void AddIntrinsics(std::list<Ptr<const Declaration>>* fs) {
|
||||
global_arena->New<ExpressionPattern>(
|
||||
global_arena->New<TupleLiteral>(loc)),
|
||||
/*is_omitted_return_type=*/false, print_return));
|
||||
fs->insert(fs->begin(), print);
|
||||
declarations->insert(declarations->begin(), print);
|
||||
}
|
||||
|
||||
void ExecProgram(std::list<Ptr<const Declaration>> fs) {
|
||||
AddIntrinsics(&fs);
|
||||
void ExecProgram(AST ast) {
|
||||
AddIntrinsics(&ast.declarations);
|
||||
if (tracing_output) {
|
||||
llvm::outs() << "********** source program **********\n";
|
||||
for (const auto decl : fs) {
|
||||
for (const auto decl : ast.declarations) {
|
||||
llvm::outs() << *decl;
|
||||
}
|
||||
llvm::outs() << "********** type checking **********\n";
|
||||
}
|
||||
TypeChecker type_checker;
|
||||
TypeChecker::TypeCheckContext p = type_checker.TopLevel(fs);
|
||||
TypeChecker::TypeCheckContext p = type_checker.TopLevel(ast.declarations);
|
||||
TypeEnv top = p.types;
|
||||
Env ct_top = p.values;
|
||||
std::list<Ptr<const Declaration>> new_decls;
|
||||
for (const auto decl : fs) {
|
||||
for (const auto decl : ast.declarations) {
|
||||
new_decls.push_back(type_checker.MakeTypeChecked(decl, top, ct_top));
|
||||
}
|
||||
if (tracing_output) {
|
||||
|
||||
@@ -11,13 +11,12 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "executable_semantics/ast/declaration.h"
|
||||
#include "executable_semantics/common/ptr.h"
|
||||
#include "executable_semantics/ast/ast.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
// Runs the top-level declaration list.
|
||||
void ExecProgram(std::list<Ptr<const Declaration>> fs);
|
||||
void ExecProgram(AST ast);
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ cc_library(
|
||||
"//common:check",
|
||||
"//common:ostream",
|
||||
"//common:string_helpers",
|
||||
"//executable_semantics/ast",
|
||||
"//executable_semantics/ast:declaration",
|
||||
"//executable_semantics/ast:expression",
|
||||
"//executable_semantics/ast:paren_contents",
|
||||
|
||||
@@ -30,6 +30,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
/* Table begin. */
|
||||
AND "and"
|
||||
API "api"
|
||||
ARROW "->"
|
||||
AUTO "auto"
|
||||
AWAIT "__await"
|
||||
@@ -53,13 +54,17 @@ FALSE "false"
|
||||
FN "fn"
|
||||
FNTY "fnty"
|
||||
IF "if"
|
||||
IMPL "impl"
|
||||
IMPORT "import"
|
||||
LEFT_CURLY_BRACE "{"
|
||||
LEFT_PARENTHESIS "("
|
||||
LEFT_SQUARE_BRACKET "["
|
||||
LIBRARY "library"
|
||||
MATCH "match"
|
||||
MINUS "-"
|
||||
NOT "not"
|
||||
OR "or"
|
||||
PACKAGE "package"
|
||||
PERIOD "."
|
||||
PLUS "+"
|
||||
RETURN "return"
|
||||
@@ -119,6 +124,7 @@ string_literal \"([^\\\"\n\v\f\r]|\\.)*\"
|
||||
|
||||
/* Table begin. */
|
||||
{AND} { return SIMPLE_TOKEN(AND); }
|
||||
{API} { return SIMPLE_TOKEN(API); }
|
||||
{ARROW} { return SIMPLE_TOKEN(ARROW); }
|
||||
{AUTO} { return SIMPLE_TOKEN(AUTO); }
|
||||
{AWAIT} { return SIMPLE_TOKEN(AWAIT); }
|
||||
@@ -142,13 +148,17 @@ string_literal \"([^\\\"\n\v\f\r]|\\.)*\"
|
||||
{FNTY} { return SIMPLE_TOKEN(FNTY); }
|
||||
{FN} { return SIMPLE_TOKEN(FN); }
|
||||
{IF} { return SIMPLE_TOKEN(IF); }
|
||||
{IMPL} { return SIMPLE_TOKEN(IMPL); }
|
||||
{IMPORT} { return SIMPLE_TOKEN(IMPORT); }
|
||||
{LEFT_PARENTHESIS} { return SIMPLE_TOKEN(LEFT_PARENTHESIS); }
|
||||
{LEFT_CURLY_BRACE} { return SIMPLE_TOKEN(LEFT_CURLY_BRACE); }
|
||||
{LEFT_SQUARE_BRACKET} { return SIMPLE_TOKEN(LEFT_SQUARE_BRACKET); }
|
||||
{LIBRARY} { return SIMPLE_TOKEN(LIBRARY); }
|
||||
{MATCH} { return SIMPLE_TOKEN(MATCH); }
|
||||
{MINUS} { return SIMPLE_TOKEN(MINUS); }
|
||||
{NOT} { return SIMPLE_TOKEN(NOT); }
|
||||
{OR} { return SIMPLE_TOKEN(OR); }
|
||||
{PACKAGE} { return SIMPLE_TOKEN(PACKAGE); }
|
||||
{PERIOD} { return SIMPLE_TOKEN(PERIOD); }
|
||||
{PLUS} { return SIMPLE_TOKEN(PLUS); }
|
||||
{RETURN} { return SIMPLE_TOKEN(RETURN); }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "executable_semantics/ast/abstract_syntax_tree.h"
|
||||
#include "executable_semantics/ast/ast.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "executable_semantics/ast/abstract_syntax_tree.h"
|
||||
#include "executable_semantics/ast/ast.h"
|
||||
#include "executable_semantics/syntax/parser.h" // from parser.ypp
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
%code requires {
|
||||
#include <optional>
|
||||
|
||||
#include "executable_semantics/ast/abstract_syntax_tree.h"
|
||||
#include "executable_semantics/ast/ast.h"
|
||||
#include "executable_semantics/ast/declaration.h"
|
||||
#include "executable_semantics/ast/expression.h"
|
||||
#include "executable_semantics/ast/function_definition.h"
|
||||
@@ -93,6 +93,11 @@
|
||||
%token <std::string> sized_type_literal
|
||||
%token <std::string> string_literal
|
||||
%type <std::string> designator
|
||||
%type <std::pair<LibraryName, bool>> package_directive
|
||||
%type <LibraryName> import_directive
|
||||
%type <std::vector<LibraryName>> import_directives
|
||||
%type <std::string> optional_library_path
|
||||
%type <bool> api_or_impl
|
||||
%type <BisonWrap<Ptr<const Declaration>>> declaration
|
||||
%type <BisonWrap<Ptr<const FunctionDefinition>>> function_declaration
|
||||
%type <BisonWrap<Ptr<const FunctionDefinition>>> function_definition
|
||||
@@ -133,6 +138,7 @@
|
||||
%token
|
||||
// Most tokens have their spelling defined in lexer.lpp.
|
||||
AND
|
||||
API
|
||||
ARROW
|
||||
AUTO
|
||||
AWAIT
|
||||
@@ -156,13 +162,17 @@
|
||||
FN
|
||||
FNTY
|
||||
IF
|
||||
IMPL
|
||||
IMPORT
|
||||
LEFT_CURLY_BRACE
|
||||
LEFT_PARENTHESIS
|
||||
LEFT_SQUARE_BRACKET
|
||||
LIBRARY
|
||||
MATCH
|
||||
MINUS
|
||||
NOT
|
||||
OR
|
||||
PACKAGE
|
||||
PERIOD
|
||||
PLUS
|
||||
RETURN
|
||||
@@ -217,8 +227,42 @@
|
||||
|
||||
%start input
|
||||
%%
|
||||
input: declaration_list
|
||||
{ parsed_program = $1; }
|
||||
input: package_directive import_directives declaration_list
|
||||
{
|
||||
parsed_program = AST({.package = $1.first,
|
||||
.is_api = $1.second,
|
||||
.imports = std::move($2),
|
||||
.declarations = std::move($3)});
|
||||
}
|
||||
;
|
||||
package_directive:
|
||||
PACKAGE identifier optional_library_path api_or_impl SEMICOLON
|
||||
{ $$ = {LibraryName({.package = $2, .path = $3}), $4}; }
|
||||
;
|
||||
import_directive:
|
||||
IMPORT identifier optional_library_path SEMICOLON
|
||||
{ $$ = LibraryName({.package = $2, .path = $3}); }
|
||||
;
|
||||
import_directives:
|
||||
// Empty
|
||||
{ $$ = std::vector<LibraryName>(); }
|
||||
| import_directives import_directive
|
||||
{
|
||||
$$ = std::move($1);
|
||||
$$.push_back($2);
|
||||
}
|
||||
;
|
||||
optional_library_path:
|
||||
// Empty
|
||||
{ $$ = ""; }
|
||||
| LIBRARY string_literal
|
||||
{ $$ = $2; }
|
||||
;
|
||||
api_or_impl:
|
||||
API
|
||||
{ $$ = true; }
|
||||
| IMPL
|
||||
{ $$ = false; }
|
||||
;
|
||||
expression:
|
||||
identifier
|
||||
|
||||
@@ -61,6 +61,9 @@ TEST_LIST = [
|
||||
"if_nesting",
|
||||
"if_true",
|
||||
"ignored_parameter",
|
||||
"import_late",
|
||||
"import_nonexistent_library",
|
||||
"import_nonexistent_package",
|
||||
"invalid_char",
|
||||
"match_any_int",
|
||||
"match_int",
|
||||
@@ -68,6 +71,8 @@ TEST_LIST = [
|
||||
"match_placeholder",
|
||||
"next",
|
||||
"no_match",
|
||||
"package_library",
|
||||
"package_missing",
|
||||
"pattern_init",
|
||||
"pattern_variable_fail",
|
||||
"placeholder_variable",
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that assignment performs a copy and does not create an alias.
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that assignment performs a copy and does not create an alias.
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var x: i32 = 0;
|
||||
{
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var x: i32 = 0;
|
||||
{
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var x: i32 = 2;
|
||||
while (true) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
choice Ints {
|
||||
None,
|
||||
One(i32),
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_access_mismatch.carbon:11: class Point does not have a field named z
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_access_mismatch.carbon:13: class Point does not have a field named z
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_mismatch.carbon:11: type error in call
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_mismatch.carbon:13: type error in call
|
||||
expected: (x = i32, y = i32)
|
||||
actual: (x = i32, z = i32)
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
class Point {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_missing.carbon:11: type error in call
|
||||
COMPILATION ERROR: executable_semantics/testdata/class_field_missing.carbon:13: type error in call
|
||||
expected: (x = i32, y = i32)
|
||||
actual: (x = i32)
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var x: auto = 2;
|
||||
while (not (x == 0)) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that creating a continuation doesn't do anything.
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test creating and running a continuation.
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test pausing a continuation with `__await` and restarting it with
|
||||
// `__run`.
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Assignment for continuations is shallow, so `k2` refers to the same
|
||||
// continuation as `k1`.
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test access to block-scoped variables upon resuming a continuation.
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test recursive functions inside continuations.
|
||||
|
||||
var current: i32 = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test the way in which copying of continuations interacts with data
|
||||
// on the stack such as the variable `x`. In this example the copy
|
||||
// happens after the variable `x` is created.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test the way in which copying of continuations interacts with data
|
||||
// on the stack such as the variable `x`. In this example the copy
|
||||
// happens before the variable `x` is created, so each continuation
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that the read from x triggers an error because x is dead.
|
||||
// This test also demonstrates how by-reference free-variable capture
|
||||
// is dangerous and can happen inside continuations.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
RUNTIME ERROR: executable_semantics/testdata/experimental_continuation9.carbon:12: undefined behavior: access to dead value 1
|
||||
RUNTIME ERROR: executable_semantics/testdata/experimental_continuation9.carbon:14: undefined behavior: access to dead value 1
|
||||
EXIT CODE: 255
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn f(x: i32) -> i32 {
|
||||
return x - 1;
|
||||
}
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// This tests the call-by-value aspect of parameter passing.
|
||||
// This makes sure that when the value in `x` dies,
|
||||
// it does not cause the value in `a` to also die.
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test multiple arguments
|
||||
fn f(x: i32, y: i32) -> i32 {
|
||||
return x + y;
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test empty parameters and return type
|
||||
fn f() { }
|
||||
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn add(x: i32, y: i32) => x + y;
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn f(x: i32, y: i32) -> i32 { return x + y; }
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/fun6_fail_type.carbon:10: type error in call
|
||||
COMPILATION ERROR: executable_semantics/testdata/fun6_fail_type.carbon:12: type error in call
|
||||
expected: (0 = i32, 1 = i32)
|
||||
actual: (0 = (0 = i32, 1 = i32))
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn f(x: i32, .d = y: i32) => x + y;
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn f(x: i32, .d = y: i32, z: i32, .e = a: i32) => (x + y) - (z + a);
|
||||
|
||||
fn main() -> i32 {
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
PROGRAM ERROR: executable_semantics/testdata/fun_named_params2.carbon:5: positional members must come before named members
|
||||
PROGRAM ERROR: executable_semantics/testdata/fun_named_params2.carbon:7: positional members must come before named members
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn f(x: i32) -> i32 {
|
||||
if (x == 0) {
|
||||
return x;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn add1(x: i32) -> i32 {
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn fst[T:! Type](x: T, y: T) -> T {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn snd[T:! Type](x: i32, y: T) -> T {
|
||||
return y;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn apply[T:! Type, U:! Type](f: fnty (T) -> U, x: T) -> U {
|
||||
return f(x);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn fst[T:! Type](x: T, y: T) -> T {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail1.carbon:10: type error in argument deduction
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail1.carbon:12: type error in argument deduction
|
||||
expected: i32
|
||||
actual: Bool
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn id[T:! Type](x: i32) -> i32 {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail2.carbon:10: could not deduce type argument for type parameter T
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail2.carbon:12: could not deduce type argument for type parameter T
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
return x + 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail3.carbon:6: type error in addition(1)
|
||||
COMPILATION ERROR: executable_semantics/testdata/generic_function_fail3.carbon:8: type error in addition(1)
|
||||
expected: i32
|
||||
actual: T
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn swap[T:! Type, U:! Type](tuple: (T, U)) -> (U, T) {
|
||||
return (tuple[1], tuple[0]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn map[T:! Type](f: fnty (T) -> T, tuple: (T, T)) -> (T, T) {
|
||||
return (f(tuple[0]), f(tuple[1]));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test global variable initialization and read.
|
||||
|
||||
var zero: i32 = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that mutations to a global variable in one function is visible
|
||||
// in another function.
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test type checking of global variable. Error expected.
|
||||
|
||||
var flag: i32 = true;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/global_variable3.carbon:7: type error in initializer of variable
|
||||
COMPILATION ERROR: executable_semantics/testdata/global_variable3.carbon:9: type error in initializer of variable
|
||||
expected: i32
|
||||
actual: Bool
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test mutation of a global variable.
|
||||
|
||||
var zero: i32 = 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test overshadowing of global variable.
|
||||
|
||||
var x: i32 = 1;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/global_variable5.carbon:10: type error in return
|
||||
COMPILATION ERROR: executable_semantics/testdata/global_variable5.carbon:12: type error in return
|
||||
expected: ()
|
||||
actual: i32
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test a global variable depending on another global.
|
||||
|
||||
var x: i32 = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test a global variable depending on a function.
|
||||
|
||||
fn f() -> i32 {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
// Test that a global variable may not depend on a later global.
|
||||
// Error expected.
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
RUNTIME ERROR: executable_semantics/testdata/global_variable8.carbon:8: could not find `y`
|
||||
RUNTIME ERROR: executable_semantics/testdata/global_variable8.carbon:10: could not find `y`
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (0 == 1) {
|
||||
return 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (0 == 1) {
|
||||
return 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (0 == 1) {
|
||||
return 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (0 == 1) {
|
||||
return 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (0 == 0) {
|
||||
if (0 == 1) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
if (1 == 1) {
|
||||
return 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn ReturnSecond(_: i32, x: i32) -> i32 {
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
import ExecutableSemanticsTest library "Nonexistent";
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/import_late.carbon:11: syntax error, unexpected IMPORT, expecting END_OF_FILE
|
||||
EXIT CODE: 255
|
||||
@@ -0,0 +1,11 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
import Nonexistent;
|
||||
|
||||
fn main() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
result: 0
|
||||
@@ -0,0 +1,11 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
import ExecutableSemanticsTest library "Nonexistent";
|
||||
|
||||
fn main() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
result: 0
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var t: auto = 5;
|
||||
match (t) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var t: auto = 5;
|
||||
match (t) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var t: auto = 5;
|
||||
match (t) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var t: auto = (1, 2, 3, 4);
|
||||
match (t) {
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main () -> i32
|
||||
{
|
||||
var x: i32 = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var x: i32 = 0;
|
||||
match (x) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest library "Foo" api;
|
||||
|
||||
fn main() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
result: 0
|
||||
@@ -0,0 +1,7 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
fn main() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/package_missing.carbon:5: syntax error, unexpected FN, expecting PACKAGE
|
||||
EXIT CODE: 255
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
var (x: auto, y: auto) = (2, 3);
|
||||
return y - x - 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
package ExecutableSemanticsTest api;
|
||||
|
||||
fn main() -> i32 {
|
||||
// error
|
||||
x : i32;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
COMPILATION ERROR: executable_semantics/testdata/pattern_variable_fail.carbon:7: syntax error, unexpected COLON
|
||||
COMPILATION ERROR: executable_semantics/testdata/pattern_variable_fail.carbon:9: syntax error, unexpected COLON
|
||||
EXIT CODE: 255
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user