mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 12:40:09 +01:00
Basic support for named constraints as described in [the generics design](https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/generics/details.md#named-constraints). Support is provided for `extends` and `impl` declarations in `constraint`, but not yet for member aliases. The missing prelude named constraints `Add`, `Mul`, `Ordered`, etc. are also added.
17 lines
543 B
Plaintext
17 lines
543 B
Plaintext
// 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
|
|
//
|
|
// AUTOUPDATE
|
|
// RUN: %{not} %{explorer-run}
|
|
// RUN: %{not} %{explorer-run-trace}
|
|
|
|
package ExplorerTest api;
|
|
|
|
constraint X {
|
|
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/named_constraint/fail_associated_function.carbon:[[@LINE+1]]: associated function not permitted in named constraint
|
|
fn F();
|
|
}
|
|
|
|
fn Main() -> i32 { return 0; }
|