* start correct

* Fix #1394

* remove llvm::outs()

* Fix #1394

* ---

* fix issue-1394

* fix issue-1394

* Update explorer/interpreter/interpreter.cpp

Co-authored-by: Geoff Romer <gromer@google.com>

* fix issue-1394

* remove and rename test files

* add changes from j.m

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
pmqtt
2022-10-13 19:44:53 +02:00
committed by GitHub
co-authored by Geoff Romer m new
parent e74c73240c
commit 6cf2272bbe
12 changed files with 51 additions and 195 deletions
@@ -1,18 +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
//
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
// AUTOUPDATE: %{explorer} %s
// CHECK:result: 0
package ExplorerTest api;
fn Id(t: Type) -> auto { return t; }
// Test non-trivial type expression in return type.
fn Main() -> Id(i32) {
return 0;
}
-19
View File
@@ -1,19 +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
//
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
// AUTOUPDATE: %{explorer} %s
// CHECK:result: 0
package ExplorerTest api;
fn Id(t: Type) -> auto { return t; }
// Test non-trivial type expression in variable declaration statement.
fn Main() -> i32 {
var x: Id(i32) = 0;
return x;
}
@@ -2,10 +2,9 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
// AUTOUPDATE: %{explorer} %s
// CHECK:result: 0
package ExplorerTest api;
@@ -13,6 +12,7 @@ fn Id(t: Type) -> auto { return t; }
// Test non-trivial type expression in parameter type.
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_param_type_is_call.carbon:[[@LINE+1]]: Function would be called at compile-time
fn f(x: Id(i32)) -> i32 {
return x;
}
@@ -0,0 +1,20 @@
// 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
//
// RUN: %{not} %{explorer} %s 2>&1 2>&1 | %{FileCheck} %s
// AUTOUPDATE: %{explorer} %s
package EmptyIdentifier impl;
fn apply[T:! Type, U:! Type](f: T, EmptyIdentifier: U)
{
match (true[true]) {}
}
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_return_type_is_call.carbon:[[@LINE+1]]: Function would be called at compile-time
fn EmptyIdentifier() -> apply(true, true);
fn Main() -> i32 {
return 0;
}
+18
View File
@@ -0,0 +1,18 @@
// 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
//
// RUN: %{not} %{explorer} %s 2>&1 2>&1 | %{FileCheck} %s
// AUTOUPDATE: %{explorer} %s
package EmptyIdentifier impl;
fn test() -> i32 {
return 1;
}
fn Main() -> i32 {
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_var_type_is_call.carbon:[[@LINE+1]]: Function would be called at compile-time
var x: test() = 1;
return 0;
}