Fix IsConcreteType for generic classes and add IsType predicate. (#1204)

* check that the return type is a type, add more implicit conversions

* update IsConcreteType for generic classes, add IsType predicate

* delete a comment

* trivial change

* move Witness wrt IsConcreteType and IsType

* added comments to tests

* update error line numbers
This commit is contained in:
Jeremy G. Siek
2022-04-25 16:25:22 -04:00
committed by GitHub
parent 0230ebdf38
commit adf1a85ee9
6 changed files with 174 additions and 16 deletions
@@ -0,0 +1,19 @@
// 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} %{executable_semantics} %s 2>&1 | \
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
// AUTOUPDATE: %{executable_semantics} %s
// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_var_type.carbon:17: Expected a type, but got 42
package ExecutableSemanticsTest api;
fn Main () -> i32
{
// 42 cannot be used as the type of a variable.
var x: 42 = 0;
return x;
}