Files
carbon-lang/explorer/testdata/assert/fail_convert.carbon
T
Prabhat Sachdeva 2f70c7d8bb Explorer: Reduce prelude path when printing source location (#3080)
The Prelude path can be very long, which can make the `SourceLocation`'s
`Print(...)` method output unnecessarily verbose. This PR modifies the
`SourceLocation`'s `Print()` method to just print the **filename** and
**line number** for prelude.
2023-08-09 17:57:07 +00:00

21 lines
545 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
// CHECK:STDERR: RUNTIME ERROR: prelude.carbon:{{\d+}}: "Fail"
package ExplorerTest api;
class ConvertTo(T:! type) {
var v: T;
extend impl as ImplicitAs(T) {
fn Convert[self: Self]() -> T { return self.v; }
}
}
fn Main() -> i32 {
Assert({.v = false} as ConvertTo(bool), {.v = "Fail"} as ConvertTo(String));
return 0;
}