mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-10 12:38:28 +00:00
Render diagnostics through the terminal library (#7683)
Diagnostic rendering was part of the data model: `Loc::FormatLocation` and `Loc::FormatSnippet` wrote plain text to a stream, so no capability, color, or terminal width could reach them. A diagnostic is now one message with labels, contexts, and location information attached, and `Diagnostics::Renderer` draws it into a `Terminal::Buffer`. The design is in `toolchain/docs/diagnostics_rendering.md` (#7668), authoring in `toolchain/docs/diagnostics.md`. Before: ``` example.carbon:6:3: error: 1 argument passed to function expecting 0 arguments Run0(1); ^~~~~~~ example.carbon:3:1: note: calling function declared here fn Run0() {} ^~~~~~~~~~~ ``` After: ``` error: 1 argument passed to function expecting 0 arguments ╭─┤ example.carbon:6:3 ┆ 3 │ fn Run0() {} · ─────┬───── · ╰──┤ calling function declared here ┆ -> 6 │ Run0(1); · ─────── ╰──────────── ``` `--no-diagnostic-snippets` gives a compact form, `example.carbon:6:3-9`. File tests use it; the rendering tests under `toolchain/diagnostics/testdata` ask for snippets. C++ interop diagnostics are data now rather than text Clang drew: `SemIR::ClangSourceLocId` names a `clang::SourceRange`, and a Clang location is marked as the point it names. `StreamConsumer` moves to a `:renderer` target that `:emitter` does not depend on, keeping `common/terminal` out of `consumer.h`. Capabilities come from the file behind the error stream, so tests get plain ASCII. `renderer_fuzzer` draws diagnostics built from fuzzer bytes with every capability combination, since a shape the renderer doesn't expect must never be why the compiler dies while reporting a problem. TODOs mark the follow-ups: line weights and crossing lines, wrapping that keeps a quoted type whole, and ordering diagnostics that share a byte offset. Also: `IncorrectExtension`'s hint moves into its message, since its note had no location of its own, and `strip_noise` in `check_diagnostics.py` blanks multi-line `#define`s instead of deleting them. Assisted-by: Claude Code
This commit is contained in:
1 parent
e1c8c1f855
commit
2c9739799b
1205 files changed
+20121
-24818
No files matched your search
@@ -2,7 +2,8 @@
|
||||
name: Diagnostics
|
||||
description:
|
||||
Instructions for declaring, formatting, emitting, testing, and styling
|
||||
diagnostic messages (errors, warnings, notes) in the Carbon toolchain.
|
||||
diagnostic messages (errors, warnings, and the labels that explain them) in
|
||||
the Carbon toolchain.
|
||||
---
|
||||
|
||||
# Diagnostics in the Carbon Toolchain
|
||||
@@ -15,9 +16,9 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
The Carbon compiler features a highly-engineered, context-aware diagnostics
|
||||
framework designed to deliver precise, readable, and highly targetable
|
||||
diagnostic output (errors, warnings, notes). This document establishes strict
|
||||
rules for declaring, formatting, emitting, testing, and styling compiler
|
||||
diagnostics.
|
||||
diagnostic output (errors, warnings, and the labels that explain them). This
|
||||
document establishes strict rules for declaring, formatting, emitting, testing,
|
||||
and styling compiler diagnostics.
|
||||
|
||||
---
|
||||
|
||||
@@ -39,8 +40,8 @@ Diagnostics are handled via three decoupled core components:
|
||||
[kind.def](../../../toolchain/diagnostics/kind.def).
|
||||
2. **Emitters**: Specialized formatting pipelines (parameterized on custom
|
||||
phase location types `LocT` like `Token` or `LocId`) that convert raw tokens
|
||||
to standardized physical source locations (file, line, column, and text
|
||||
snippet).
|
||||
to standardized physical source locations (file, line, column, and the text
|
||||
of the line).
|
||||
3. **Consumers**: Pipelines that process, track, filter, and sort diagnostics.
|
||||
The default `SortingConsumer` buffers and stable-sorts diagnostics based on
|
||||
their `last_byte_offset` matching compiler traversal order to ensure perfect
|
||||
@@ -86,7 +87,7 @@ declaration (`CARBON_DIAGNOSTIC` or `CARBON_DIAGNOSTIC_ON_SCOPE`).
|
||||
- **File Scope**: If the diagnostic is shared among multiple functions inside
|
||||
the _same_ file, declare it at **file scope** inside the anonymous namespace
|
||||
of the `.cpp` file.
|
||||
- **Global Scope**: If a diagnostic (such as a shared helper note) is reused
|
||||
- **Global Scope**: If a diagnostic (such as a shared helper label) is reused
|
||||
_across different physical files_, define it in a shared header (e.g.
|
||||
context/check helpers) and mark it `extern` where applicable, ensuring the
|
||||
macro is only invoked once.
|
||||
@@ -155,40 +156,66 @@ Custom structures can define how they serialize inside diagnostics using the
|
||||
|
||||
### Fluent Builder Pattern
|
||||
|
||||
For compound diagnostics requiring multiple sub-notes, carets, or custom code
|
||||
overrides, use `Build` to chain actions fluently:
|
||||
A diagnostic is one message plus the labels that mark the source explaining it.
|
||||
Use `Build` to state the message and `Attach` to mark each place the reader has
|
||||
to look, chained fluently:
|
||||
|
||||
```cpp
|
||||
CARBON_DIAGNOSTIC_LABEL(ModifierPrevious, Info, "`{0}` previously appeared here",
|
||||
Lex::TokenKind);
|
||||
|
||||
context.emitter()
|
||||
.Build(second_node, ModifierRepeated, context.token_kind(second_node))
|
||||
.Note(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.OverrideSnippet("custom snippet...")
|
||||
.Attach(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.Emit();
|
||||
```
|
||||
|
||||
Labels are declared with `CARBON_DIAGNOSTIC_LABEL` where they are attached, and
|
||||
are not registered in `kind.def`; `check_diagnostics.py` checks that each one is
|
||||
attached and covered. A label is either `Primary` -- the range the message
|
||||
itself is about -- or `Info`, for somewhere else the reader must look; those two
|
||||
are the only categories, because anything not read against the code it names is
|
||||
not a label. `Attach(loc)` with no label marks a range wordlessly, which is what
|
||||
to use when a label would only restate the message.
|
||||
|
||||
Every diagnostic should attach at least one label; a message with nothing
|
||||
attached has nothing to show. See
|
||||
[diagnostics.md](../../../toolchain/docs/diagnostics.md) for which range to pick
|
||||
and when a label earns words.
|
||||
|
||||
> [!SAFETY] Emitter builders are marked `[[nodiscard]]`. To prevent a developer
|
||||
> from creating a builder but failing to terminal-chain `.Emit()`, the builder
|
||||
> uses an rvalue overload `Emit() &&` that triggers a compile-time
|
||||
> `static_assert(false)`. You must save the builder to an lvalue or execute the
|
||||
> chain exactly as `emitter.Build(...).Note(...).Emit()`.
|
||||
> chain exactly as `emitter.Build(...).Attach(...).Emit()`.
|
||||
|
||||
### RAII Context & Annotation Scopes
|
||||
|
||||
Manage large checking structures requiring blanket note context using RAII block
|
||||
Manage large checking structures requiring blanket context using RAII block
|
||||
scopes:
|
||||
|
||||
- `ContextScope`: Automatically converts any diagnostics emitted within its
|
||||
scope into sub-notes under a high-level operation descriptor:
|
||||
- `ContextScope`: Attaches a context to every diagnostic emitted within its
|
||||
scope, describing the higher-level operation that failed because of it. A
|
||||
context is declared with `CARBON_DIAGNOSTIC_CONTEXT`, or
|
||||
`CARBON_DIAGNOSTIC_SOFT_CONTEXT` for one dropped when the diagnostic
|
||||
already has a context:
|
||||
|
||||
```cpp
|
||||
ContextScope context_scope(&context.emitter(), [&](ContextBuilder& builder) {
|
||||
builder.Context(eval_loc, InCallToEvalFn);
|
||||
Diagnostics::ContextScope diagnostic_context(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
QualifiedDeclInIncompleteClassScope,
|
||||
"cannot declare a member of incomplete class {0}", SemIR::TypeId);
|
||||
builder.Attach(loc_id, QualifiedDeclInIncompleteClassScope,
|
||||
context.classes().Get(class_id).self_type_id);
|
||||
});
|
||||
// any checker error emitted here will automatically append the 'InCallToEvalFn' note
|
||||
```
|
||||
|
||||
- `AnnotationScope`: RAII block scope that automatically attaches blanket note
|
||||
annotations to all scoped diagnostics.
|
||||
A context is not a label: its text stands alone as a sentence, which is why
|
||||
it leads the diagnostic rather than following it.
|
||||
|
||||
- `AnnotationScope`: RAII block scope that attaches labels to every diagnostic
|
||||
emitted within it, using the same `Builder` as a direct emission.
|
||||
|
||||
---
|
||||
|
||||
@@ -257,5 +284,15 @@ Carbon strictly enforces testing coverage at build-time.
|
||||
```
|
||||
|
||||
3. **Build Enforcement**: Failing to provide a diagnostic test check matcher
|
||||
triggers a build compilation error on the target test
|
||||
triggers a failure on the target test
|
||||
`//toolchain/diagnostics:coverage_test`.
|
||||
4. **Label Enforcement**: A label is declared where it is attached rather than
|
||||
in a central registry, so `coverage_test` has no list of labels to compare a
|
||||
matched name against and leaves any name that isn't a kind alone.
|
||||
[check_diagnostics.py](../../../toolchain/diagnostics/check_diagnostics.py)
|
||||
is what checks them: it reads the declarations and the testdata directly, so
|
||||
it catches a label with no test, a name matched on that is neither a kind
|
||||
nor a label, and a kind registered in `kind.def` that nothing declares. It
|
||||
runs as a pre-commit hook, which CI runs too, rather than as a bazel test --
|
||||
reading every source file is what it needs and what a test in the sandbox
|
||||
cannot do.
|
||||
@@ -173,8 +173,9 @@ repos:
|
||||
(?x)^(
|
||||
toolchain/.*\.cpp|
|
||||
toolchain/.*\.h|
|
||||
toolchain/.*/testdata/.*|
|
||||
toolchain/diagnostics/check_diagnostics\.py|
|
||||
toolchain/diagnostics/diagnostic_kind\.def
|
||||
toolchain/diagnostics/kind\.def
|
||||
)$
|
||||
pass_filenames: false
|
||||
|
||||
|
||||
@@ -287,6 +287,12 @@ class Buffer {
|
||||
//
|
||||
// A cell's style is whatever was drawn there last, so crossing lines of
|
||||
// different styles do depend on order.
|
||||
//
|
||||
// TODO: Every line is drawn with one stroke, and a line meeting another
|
||||
// joins it. Diagnostic rendering needs a heavier stroke, to mark the source
|
||||
// a message is about, and a line that passes another without connecting, to
|
||||
// reach a label past the marks between them. Add a weight to these calls
|
||||
// and a crossing form of `DrawVerticalLine`.
|
||||
auto DrawHorizontalLine(int x, int y, int length, const Style& style,
|
||||
LineEnd start = LineEnd::Center,
|
||||
LineEnd end = LineEnd::Center) -> DrawEnd;
|
||||
@@ -391,6 +397,10 @@ class Buffer {
|
||||
// with such text, since which breaks a reflow may discard -- every newline,
|
||||
// or only those a previous wrapping introduced -- is a question about where
|
||||
// that text came from.
|
||||
//
|
||||
// TODO: A break can fall inside a piece of code the text quotes, splitting a
|
||||
// type written with spaces in it across two rows. Take a quote character and
|
||||
// keep what a pair of them encloses in one word, as a URL already is.
|
||||
auto DrawWrappedText(int x, int y, int margin, int max_width,
|
||||
llvm::StringRef text, const Style& style) -> DrawEnd;
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ cc_library(
|
||||
"//toolchain/sem_ir:absolute_node_ref",
|
||||
"//toolchain/sem_ir:clang_decl",
|
||||
"//toolchain/sem_ir:cpp_file",
|
||||
"//toolchain/sem_ir:diagnostic_loc_converter",
|
||||
"//toolchain/sem_ir:expr_info",
|
||||
"//toolchain/sem_ir:file",
|
||||
"//toolchain/sem_ir:formatter",
|
||||
@@ -261,6 +262,7 @@ cc_library(
|
||||
"//toolchain/base:timings",
|
||||
"//toolchain/diagnostics:emitter",
|
||||
"//toolchain/diagnostics:format_providers",
|
||||
"//toolchain/diagnostics:renderer",
|
||||
"//toolchain/lex:token_index",
|
||||
"//toolchain/lex:token_kind",
|
||||
"//toolchain/lex:tokenized_buffer",
|
||||
|
||||
@@ -83,7 +83,8 @@ static auto ResolveCalleeInCall(Context& context, SemIR::LocId loc_id,
|
||||
" expecting {2} argument{2:s}",
|
||||
Diagnostics::IntAsSelect, Diagnostics::IntAsSelect,
|
||||
Diagnostics::IntAsSelect);
|
||||
CARBON_DIAGNOSTIC(InCallToEntity, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
InCallToEntity, Info,
|
||||
"calling {0:=0:function|=1:generic class|=2:generic "
|
||||
"interface|=3:generic constraint}"
|
||||
" declared here",
|
||||
@@ -91,7 +92,7 @@ static auto ResolveCalleeInCall(Context& context, SemIR::LocId loc_id,
|
||||
context.emitter()
|
||||
.Build(loc_id, CallArgCountMismatch, arg_ids.size(),
|
||||
static_cast<int>(entity_kind_for_diagnostic), expected_args_size)
|
||||
.Note(entity.latest_decl_id(), InCallToEntity,
|
||||
.Attach(entity.latest_decl_id(), InCallToEntity,
|
||||
static_cast<int>(entity_kind_for_diagnostic))
|
||||
.Emit();
|
||||
return std::nullopt;
|
||||
@@ -257,12 +258,12 @@ auto PerformCallToFunction(Context& context, SemIR::LocId loc_id,
|
||||
CARBON_DIAGNOSTIC(CallBeforeReturnTypeDeduced, Error,
|
||||
"call to `{0}` before its return type is deduced",
|
||||
SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(ReturnTypeDeducedFromDefinition, Note,
|
||||
"return type of `{0}` is deduced from its definition",
|
||||
SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
ReturnTypeDeducedFromDefinition, Info,
|
||||
"return type of `{0}` is deduced from its definition", SemIR::NameId);
|
||||
context.emitter()
|
||||
.Build(loc_id, CallBeforeReturnTypeDeduced, callee.name_id)
|
||||
.Note(callee.latest_decl_id(), ReturnTypeDeducedFromDefinition,
|
||||
.Attach(callee.latest_decl_id(), ReturnTypeDeducedFromDefinition,
|
||||
callee.name_id)
|
||||
.Emit();
|
||||
return SemIR::ErrorInst::InstId;
|
||||
@@ -283,9 +284,9 @@ auto PerformCallToFunction(Context& context, SemIR::LocId loc_id,
|
||||
if (callee.return_pattern_id.has_value()) {
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteReturnTypeHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(IncompleteReturnTypeHere, Info,
|
||||
"return type declared here");
|
||||
builder.Note(callee.return_pattern_id, IncompleteReturnTypeHere);
|
||||
builder.Attach(callee.return_pattern_id, IncompleteReturnTypeHere);
|
||||
});
|
||||
auto arg_type_id = CheckFunctionReturnPatternType(
|
||||
context, loc_id, callee.return_pattern_id, *callee_specific_id);
|
||||
@@ -488,7 +489,7 @@ static auto PerformCallHelper(Context& context, SemIR::LocId loc_id,
|
||||
}
|
||||
|
||||
case CARBON_KIND(SemIR::CalleeCppOverloadSet overload): {
|
||||
return PerformCallToCppFunction(context, loc_id,
|
||||
return PerformCallToCppFunction(context, loc_id, callee_id,
|
||||
overload.cpp_overload_set_id,
|
||||
overload.self_id, arg_ids, is_desugared);
|
||||
}
|
||||
|
||||
+10
-13
@@ -123,9 +123,9 @@ static auto TrackImport(Map<ImportKey, UnitAndImports*>& api_map,
|
||||
!insert_result.is_inserted()) {
|
||||
CARBON_DIAGNOSTIC(RepeatedImport, Error,
|
||||
"library imported more than once");
|
||||
CARBON_DIAGNOSTIC(FirstImported, Note, "first import here");
|
||||
CARBON_DIAGNOSTIC_LABEL(FirstImported, Info, "first import here");
|
||||
unit_info.emitter.Build(import.node_id, RepeatedImport)
|
||||
.Note(insert_result.value(), FirstImported)
|
||||
.Attach(insert_result.value(), FirstImported)
|
||||
.Emit();
|
||||
return;
|
||||
}
|
||||
@@ -311,20 +311,17 @@ static auto BuildApiMapAndDiagnosePackaging(
|
||||
bool is_api_with_impl_ext = !is_impl && filename.ends_with(ImplExt);
|
||||
auto want_ext = is_impl ? ImplExt : ApiExt;
|
||||
if (is_api_with_impl_ext || !filename.ends_with(want_ext)) {
|
||||
// The diagnostic is about the file rather than anything in it, so
|
||||
// there is no range to mark and the hint goes in the message: a label
|
||||
// would have no location of its own to be drawn at.
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncorrectExtension, Error,
|
||||
"file extension of `{0:.impl|}.carbon` required for {0:`impl`|api}",
|
||||
Diagnostics::BoolAsSelect);
|
||||
auto diag = unit_info.emitter.Build(
|
||||
"file extension of `{0:.impl|}.carbon` required for {0:`impl`|api}"
|
||||
"{1:; `.impl.carbon` names an `impl` file|}",
|
||||
Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect);
|
||||
unit_info.emitter.Emit(
|
||||
packaging ? packaging->names.node_id : Parse::NodeId::None,
|
||||
IncorrectExtension, is_impl);
|
||||
if (is_api_with_impl_ext) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncorrectExtensionImplNote, Note,
|
||||
"file extension of `.impl.carbon` only allowed for `impl`");
|
||||
diag.Note(Parse::NodeId::None, IncorrectExtensionImplNote);
|
||||
}
|
||||
diag.Emit();
|
||||
IncorrectExtension, is_impl, is_api_with_impl_ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,25 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
|
||||
|
||||
llvm::raw_null_ostream null_ostream;
|
||||
Driver driver(fs, install_paths, /*input_stream=*/nullptr, &null_ostream,
|
||||
&null_ostream, /*fuzzing=*/true);
|
||||
&null_ostream, /*error_file=*/{}, /*fuzzing=*/true);
|
||||
|
||||
// Force Unicode and color output. The output stream isn't a terminal, so
|
||||
// diagnostics would otherwise render as plain ASCII without color, and the
|
||||
// fuzzer would never reach the renderer's handling of UTF-8 and double-width
|
||||
// characters.
|
||||
static constexpr llvm::StringLiteral RenderArgs[] = {
|
||||
"--terminal-unicode=always", "--color=always"};
|
||||
|
||||
// TODO: Get checking to a point where it can handle invalid parse trees
|
||||
// without crashing.
|
||||
if (!driver.RunCommand({"compile", "--phase=parse", TestFileName}).success) {
|
||||
if (!driver
|
||||
.RunCommand({RenderArgs[0], RenderArgs[1], "compile",
|
||||
"--phase=parse", TestFileName})
|
||||
.success) {
|
||||
return 0;
|
||||
}
|
||||
driver.RunCommand({"compile", "--phase=check", TestFileName});
|
||||
driver.RunCommand(
|
||||
{RenderArgs[0], RenderArgs[1], "compile", "--phase=check", TestFileName});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "toolchain/check/type_structure.h"
|
||||
#include "toolchain/check/unused.h"
|
||||
#include "toolchain/diagnostics/diagnostic.h"
|
||||
#include "toolchain/diagnostics/renderer.h"
|
||||
#include "toolchain/sem_ir/function.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/import_ir.h"
|
||||
@@ -380,10 +381,10 @@ auto CheckUnit::ProcessNodeIds() -> bool {
|
||||
PrettyStackTraceFunction node_dumper([&](llvm::raw_ostream& output) {
|
||||
const auto& tree = tree_and_subtrees_getter_();
|
||||
auto converted = tree.NodeToDiagnosticLoc(node_id, /*token_only=*/false);
|
||||
converted.loc.FormatLocation(output);
|
||||
output << Diagnostics::FormatLocation(converted.loc) << ": ";
|
||||
output << "Checking " << context_.parse_tree().node_kind(node_id) << "\n";
|
||||
// Crash output has a tab indent; try to indent slightly past that.
|
||||
converted.loc.FormatSnippet(output, /*indent=*/10);
|
||||
Diagnostics::PrintSnippet(output, converted.loc, /*indent=*/10);
|
||||
});
|
||||
|
||||
while (auto maybe_node_id = traversal.Next()) {
|
||||
@@ -507,14 +508,14 @@ auto CheckUnit::CheckRequiredDefinitions() -> void {
|
||||
if (!ResolveSpecificDefinition(context_, loc, specific_id)) {
|
||||
CARBON_DIAGNOSTIC(MissingGenericFunctionDefinition, Error,
|
||||
"use of undefined generic function");
|
||||
CARBON_DIAGNOSTIC(MissingGenericFunctionDefinitionHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(MissingGenericFunctionDefinitionHere, Info,
|
||||
"generic function declared here");
|
||||
auto generic_decl_id =
|
||||
context_.generics()
|
||||
.Get(context_.specifics().Get(specific_id).generic_id)
|
||||
.decl_id;
|
||||
emitter_.Build(loc, MissingGenericFunctionDefinition)
|
||||
.Note(generic_decl_id, MissingGenericFunctionDefinitionHere)
|
||||
.Attach(generic_decl_id, MissingGenericFunctionDefinitionHere)
|
||||
.Emit();
|
||||
}
|
||||
}
|
||||
@@ -568,18 +569,19 @@ auto CheckUnit::CheckPoisonedConcreteImplLookupQueries() -> void {
|
||||
"found `impl` that would change the result of an earlier "
|
||||
"use of `{0} as {1}`",
|
||||
InstIdAsRawType, SpecificInterfaceIdAsRawType);
|
||||
CARBON_DIAGNOSTIC(
|
||||
PoisonedImplLookupConcreteResultNoteBadImpl, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
PoisonedImplLookupConcreteResultNoteBadImpl, Info,
|
||||
"the use would select the `impl` here but it was not found yet");
|
||||
CARBON_DIAGNOSTIC(PoisonedImplLookupConcreteResultNotePreviousImpl,
|
||||
Note, "the use had selected the `impl` here");
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
PoisonedImplLookupConcreteResultNotePreviousImpl, Info,
|
||||
"the use had selected the `impl` here");
|
||||
emitter_
|
||||
.Build(poison.loc_id, PoisonedImplLookupConcreteResult,
|
||||
poison.query.query_self_inst_id,
|
||||
poison.query.query_specific_interface_id)
|
||||
.Note(bad_impl.first_decl_id(),
|
||||
.Attach(bad_impl.first_decl_id(),
|
||||
PoisonedImplLookupConcreteResultNoteBadImpl)
|
||||
.Note(prev_impl.first_decl_id(),
|
||||
.Attach(prev_impl.first_decl_id(),
|
||||
PoisonedImplLookupConcreteResultNotePreviousImpl)
|
||||
.Emit();
|
||||
} else {
|
||||
@@ -587,8 +589,8 @@ auto CheckUnit::CheckPoisonedConcreteImplLookupQueries() -> void {
|
||||
PoisonedImplLookupCustomResult, Error,
|
||||
"found `impl` for {0} as {1}, which has a custom witness",
|
||||
InstIdAsRawType, SpecificInterfaceIdAsRawType);
|
||||
CARBON_DIAGNOSTIC(
|
||||
PoisonedImplLookupCustomResultNoteBadImpl, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
PoisonedImplLookupCustomResultNoteBadImpl, Info,
|
||||
"the use tried to select the `impl` here, but a custom "
|
||||
"witness was already chosen");
|
||||
|
||||
@@ -596,7 +598,7 @@ auto CheckUnit::CheckPoisonedConcreteImplLookupQueries() -> void {
|
||||
.Build(poison.loc_id, PoisonedImplLookupCustomResult,
|
||||
poison.query.query_self_inst_id,
|
||||
poison.query.query_specific_interface_id)
|
||||
.Note(prev_impl.first_decl_id(),
|
||||
.Attach(prev_impl.first_decl_id(),
|
||||
PoisonedImplLookupCustomResultNoteBadImpl)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -60,21 +60,22 @@ static auto CheckCompleteAdapterClassType(
|
||||
const auto& class_info = context.classes().Get(class_id);
|
||||
if (class_info.base_id.has_value()) {
|
||||
CARBON_DIAGNOSTIC(AdaptWithBase, Error, "adapter with base class");
|
||||
CARBON_DIAGNOSTIC(AdaptWithBaseHere, Note, "`base` declaration is here");
|
||||
CARBON_DIAGNOSTIC_LABEL(AdaptWithBaseHere, Info,
|
||||
"`base` declaration is here");
|
||||
context.emitter()
|
||||
.Build(class_info.adapt_id, AdaptWithBase)
|
||||
.Note(class_info.base_id, AdaptWithBaseHere)
|
||||
.Attach(class_info.base_id, AdaptWithBaseHere)
|
||||
.Emit();
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
|
||||
if (!field_decls.empty()) {
|
||||
CARBON_DIAGNOSTIC(AdaptWithFields, Error, "adapter with fields");
|
||||
CARBON_DIAGNOSTIC(AdaptWithFieldHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(AdaptWithFieldHere, Info,
|
||||
"first field declaration is here");
|
||||
context.emitter()
|
||||
.Build(class_info.adapt_id, AdaptWithFields)
|
||||
.Note(field_decls.front(), AdaptWithFieldHere)
|
||||
.Attach(field_decls.front(), AdaptWithFieldHere)
|
||||
.Emit();
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
@@ -87,11 +88,11 @@ static auto CheckCompleteAdapterClassType(
|
||||
SemIR::Function::VirtualModifier::Virtual) {
|
||||
CARBON_DIAGNOSTIC(AdaptWithVirtual, Error,
|
||||
"adapter with virtual function");
|
||||
CARBON_DIAGNOSTIC(AdaptWithVirtualHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(AdaptWithVirtualHere, Info,
|
||||
"first virtual function declaration is here");
|
||||
context.emitter()
|
||||
.Build(class_info.adapt_id, AdaptWithVirtual)
|
||||
.Note(inst_id, AdaptWithVirtualHere)
|
||||
.Attach(inst_id, AdaptWithVirtualHere)
|
||||
.Emit();
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
@@ -316,7 +317,8 @@ static auto BuildVtable(Context& context, Parse::ClassDefinitionId node_id,
|
||||
} else if (!implemented_impls.Lookup(fn_decl.function_id)) {
|
||||
CARBON_DIAGNOSTIC(OverrideWithoutVirtualInBase, Error,
|
||||
"override without compatible virtual in base class");
|
||||
CARBON_DIAGNOSTIC(OverrideCandidateArityMismatch, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
OverrideCandidateArityMismatch, Info,
|
||||
"base class function has {2:more|fewer} parameters "
|
||||
"({0} vs {1} excluding `self`)",
|
||||
Diagnostics::IntAsSelect, Diagnostics::IntAsSelect,
|
||||
@@ -338,7 +340,7 @@ static auto BuildVtable(Context& context, Parse::ClassDefinitionId node_id,
|
||||
const auto& base_fn = context.sem_ir().functions().Get(fn_id);
|
||||
switch (CompareVirtualWithOverrider(base_fn, fn)) {
|
||||
case OverrideMatchResult::ArityMismatch:
|
||||
builder.Note(base_fn.first_owning_decl_id,
|
||||
builder.Attach(base_fn.first_owning_decl_id,
|
||||
OverrideCandidateArityMismatch,
|
||||
base_fn.call_param_ranges.explicit_size() - 1,
|
||||
fn.call_param_ranges.explicit_size() - 1,
|
||||
|
||||
+18
-16
@@ -1492,8 +1492,9 @@ static auto PerformBuiltinConversion(Context& context, SemIR::LocId loc_id,
|
||||
// the type (or some part of it) is not copyable.
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InCopy, Note, "in copy of {0}", TypeOfInstId);
|
||||
builder.Note(value_id, InCopy, value_id);
|
||||
CARBON_DIAGNOSTIC_LABEL(InCopy, Info, "in copy of {0}",
|
||||
TypeOfInstId);
|
||||
builder.Attach(value_id, InCopy, value_id);
|
||||
});
|
||||
|
||||
foundation_value_id = PerformBuiltinConversion(
|
||||
@@ -1861,9 +1862,10 @@ static auto PerformCopy(Context& context, SemIR::InstId expr_id,
|
||||
auto copy_id = BuildUnaryOperator(
|
||||
context, SemIR::LocId(expr_id), {.interface_name = CoreIdentifier::Copy},
|
||||
expr_id, target.diagnose, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(CopyOfUncopyableType, Context,
|
||||
"cannot copy value of type {0}", TypeOfInstId);
|
||||
builder.Context(expr_id, CopyOfUncopyableType, expr_id);
|
||||
CARBON_DIAGNOSTIC_CONTEXT(CopyOfUncopyableType,
|
||||
"cannot copy value of type {0}",
|
||||
TypeOfInstId);
|
||||
builder.Attach(expr_id, CopyOfUncopyableType, expr_id);
|
||||
});
|
||||
return copy_id;
|
||||
}
|
||||
@@ -1924,24 +1926,24 @@ static auto PerformUserDefinedConversion(Context& context, SemIR::LocId loc_id,
|
||||
: target.kind == ConversionTarget::ExplicitUnsafeAs ? 2
|
||||
: 0;
|
||||
if (context.types().Is<SemIR::FacetType>(target.type_id)) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ConversionFailureNonTypeToFacet, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
ConversionFailureNonTypeToFacet,
|
||||
"cannot{0:=0: implicitly|:} convert non-type value of type {1} "
|
||||
"{2:to|into type implementing} {3}"
|
||||
"{0:=1: with `as`|=2: with `unsafe as`|:}",
|
||||
Diagnostics::IntAsSelect, TypeOfInstId, Diagnostics::BoolAsSelect,
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, ConversionFailureNonTypeToFacet,
|
||||
builder.Attach(loc_id, ConversionFailureNonTypeToFacet,
|
||||
target_kind_for_diag, expr_id,
|
||||
target.type_id == SemIR::TypeType::TypeId,
|
||||
target.type_id);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ConversionFailure, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
ConversionFailure,
|
||||
"cannot{0:=0: implicitly|:} convert expression of type "
|
||||
"{1} to {2}{0:=1: with `as`|=2: with `unsafe as`|:}",
|
||||
Diagnostics::IntAsSelect, TypeOfInstId, SemIR::TypeId);
|
||||
builder.Context(loc_id, ConversionFailure, target_kind_for_diag,
|
||||
builder.Attach(loc_id, ConversionFailure, target_kind_for_diag,
|
||||
expr_id, target.type_id);
|
||||
}
|
||||
});
|
||||
@@ -2523,13 +2525,13 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
|
||||
!target.is_initializer(),
|
||||
"Initialization of incomplete types is expected to be "
|
||||
"caught elsewhere.");
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInValueConversion, Context,
|
||||
"forming value of incomplete type {0}",
|
||||
SemIR::TypeId);
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInConversion, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInValueConversion,
|
||||
"forming value of incomplete type {0}", SemIR::TypeId);
|
||||
CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInConversion,
|
||||
"invalid use of incomplete type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id,
|
||||
builder.Attach(loc_id,
|
||||
target.kind == ConversionTarget::Value
|
||||
? IncompleteTypeInValueConversion
|
||||
: IncompleteTypeInConversion,
|
||||
|
||||
@@ -52,6 +52,7 @@ static auto SplitCallArgumentList(Context& context,
|
||||
}
|
||||
|
||||
auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::InstId callee_expr_id,
|
||||
SemIR::CppOverloadSetId overload_set_id,
|
||||
SemIR::InstId self_id,
|
||||
llvm::ArrayRef<SemIR::InstId> arg_ids,
|
||||
@@ -59,8 +60,9 @@ auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id,
|
||||
auto [template_arg_ids, function_arg_ids] =
|
||||
SplitCallArgumentList(context, arg_ids);
|
||||
auto callee_id = PerformCppOverloadResolution(
|
||||
context, loc_id, context.cpp_overload_sets().Get(overload_set_id),
|
||||
template_arg_ids, self_id, function_arg_ids);
|
||||
context, loc_id, callee_expr_id,
|
||||
context.cpp_overload_sets().Get(overload_set_id), template_arg_ids,
|
||||
self_id, function_arg_ids);
|
||||
SemIR::Callee callee = GetCallee(context.sem_ir(), callee_id);
|
||||
CARBON_KIND_SWITCH(callee) {
|
||||
case CARBON_KIND(SemIR::CalleeError _): {
|
||||
|
||||
@@ -31,6 +31,9 @@ auto ConvertArgsToTemplateArgs(Context& context,
|
||||
// function call in user code, so arguments to `ref` parameters aren't required
|
||||
// to have `ref` tags.
|
||||
//
|
||||
// `callee_expr_id` is the expression naming the overload set, which is what a
|
||||
// diagnostic about the call marks.
|
||||
//
|
||||
// Chooses the best viable C++ function by performing Clang overloading
|
||||
// resolution over the overload set.
|
||||
//
|
||||
@@ -44,6 +47,7 @@ auto ConvertArgsToTemplateArgs(Context& context,
|
||||
// possible. Keeping the same behavior here for consistency and supporting
|
||||
// migrations so that the migrated callers from C++ remain valid.
|
||||
auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::InstId callee_expr_id,
|
||||
SemIR::CppOverloadSetId overload_set_id,
|
||||
SemIR::InstId self_id,
|
||||
llvm::ArrayRef<SemIR::InstId> arg_ids,
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <string>
|
||||
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/DiagnosticSema.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/CompilerInvocation.h"
|
||||
#include "clang/Frontend/TextDiagnostic.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "common/check.h"
|
||||
#include "common/raw_string_ostream.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@@ -21,31 +21,27 @@
|
||||
#include "toolchain/check/cpp/location.h"
|
||||
#include "toolchain/diagnostics/diagnostic.h"
|
||||
#include "toolchain/diagnostics/emitter.h"
|
||||
#include "toolchain/sem_ir/diagnostic_loc_converter.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
class CarbonClangDiagnosticConsumer;
|
||||
|
||||
// A diagnostic emitter that maps Clang SourceLocations to Carbon diagnostic
|
||||
// A diagnostic emitter that maps Clang source ranges to Carbon diagnostic
|
||||
// locations.
|
||||
class ClangLocDiagnosticEmitter
|
||||
: public Diagnostics::Emitter<clang::SourceLocation> {
|
||||
: public Diagnostics::Emitter<clang::CharSourceRange> {
|
||||
public:
|
||||
explicit ClangLocDiagnosticEmitter(Diagnostics::Consumer* consumer,
|
||||
const clang::SourceManager* source_manager)
|
||||
: Emitter(consumer), source_manager_(source_manager) {}
|
||||
|
||||
protected:
|
||||
auto ConvertLoc(clang::SourceLocation loc, ContextFnT /*context_fn*/) const
|
||||
auto ConvertLoc(clang::CharSourceRange range, ContextFnT /*context_fn*/) const
|
||||
-> Diagnostics::ConvertedLoc override {
|
||||
Diagnostics::Loc result_loc;
|
||||
if (source_manager_ && loc.isValid()) {
|
||||
clang::PresumedLoc presumed_loc = source_manager_->getPresumedLoc(loc);
|
||||
if (presumed_loc.isValid()) {
|
||||
result_loc.filename = presumed_loc.getFilename();
|
||||
result_loc.line_number = presumed_loc.getLine();
|
||||
result_loc.column_number = presumed_loc.getColumn();
|
||||
}
|
||||
if (source_manager_) {
|
||||
result_loc = SemIR::ConvertClangRangeToLoc(*source_manager_, range);
|
||||
}
|
||||
return {.loc = result_loc, .last_byte_offset = -1};
|
||||
}
|
||||
@@ -54,6 +50,34 @@ class ClangLocDiagnosticEmitter
|
||||
const clang::SourceManager* source_manager_;
|
||||
};
|
||||
|
||||
// Attaches a label saying what Clang suggests be done to a range. Clang words
|
||||
// these as an edit to make, so they read as an instruction rather than as a
|
||||
// description of the code.
|
||||
//
|
||||
// TODO: Carry fix-its as data -- span, replacement, confidence -- in a form
|
||||
// Carbon's own diagnostics can share, rather than wording the edit into a
|
||||
// label here, and render both as a unified diff following GCC's example
|
||||
// rather than Clang's. See future work in
|
||||
// /toolchain/docs/diagnostics_rendering.md.
|
||||
template <typename BuilderT, typename LocT>
|
||||
static auto AttachFixIt(BuilderT& builder, LocT loc,
|
||||
const CppDiagnosticListener::FixIt& fix_it) -> void {
|
||||
if (fix_it.text.empty()) {
|
||||
CARBON_DIAGNOSTIC_LABEL(CppInteropFixItRemoval, Info, "remove this");
|
||||
builder.Attach(loc, CppInteropFixItRemoval);
|
||||
return;
|
||||
}
|
||||
if (fix_it.range.getBegin() == fix_it.range.getEnd()) {
|
||||
CARBON_DIAGNOSTIC_LABEL(CppInteropFixItInsertion, Info, "insert `{0}` here",
|
||||
std::string);
|
||||
builder.Attach(loc, CppInteropFixItInsertion, fix_it.text);
|
||||
return;
|
||||
}
|
||||
CARBON_DIAGNOSTIC_LABEL(CppInteropFixItReplacement, Info,
|
||||
"replace with `{0}`", std::string);
|
||||
builder.Attach(loc, CppInteropFixItReplacement, fix_it.text);
|
||||
}
|
||||
|
||||
// Returns the diagnostic to use for a given Clang diagnostic level.
|
||||
static auto GetDiagnostic(clang::DiagnosticsEngine::Level level)
|
||||
-> const Diagnostics::DiagnosticBase<std::string>& {
|
||||
@@ -63,8 +87,13 @@ static auto GetDiagnostic(clang::DiagnosticsEngine::Level level)
|
||||
break;
|
||||
}
|
||||
case clang::DiagnosticsEngine::Note: {
|
||||
CARBON_DIAGNOSTIC(CppInteropParseNote, Note, "{0}", std::string);
|
||||
return CppInteropParseNote;
|
||||
// A note explains the diagnostic it follows and is attached to that one
|
||||
// as a label. One can still lead a buffer -- a flush can land between an
|
||||
// error and its trailing notes, and Clang can emit a stray note -- and
|
||||
// however wrong that is of Clang, it must not be why a compiler dies
|
||||
// while reporting a problem.
|
||||
CARBON_DIAGNOSTIC(CppInteropStrayNote, Warning, "{0}", std::string);
|
||||
return CppInteropStrayNote;
|
||||
}
|
||||
case clang::DiagnosticsEngine::Remark:
|
||||
case clang::DiagnosticsEngine::Warning: {
|
||||
@@ -81,6 +110,158 @@ static auto GetDiagnostic(clang::DiagnosticsEngine::Level level)
|
||||
}
|
||||
}
|
||||
|
||||
// Returns whether `range` holds `loc`, which needs both to be spelled in the
|
||||
// same file: two offsets from different files are unordered, and comparing them
|
||||
// would report a containment that isn't one.
|
||||
static auto Contains(const clang::SourceManager& source_manager,
|
||||
clang::CharSourceRange range, clang::SourceLocation loc)
|
||||
-> bool {
|
||||
if (range.isInvalid()) {
|
||||
return false;
|
||||
}
|
||||
CARBON_CHECK(range.isCharRange(), "Widen a token range before comparing.");
|
||||
auto [file_id, offset] = source_manager.getDecomposedSpellingLoc(loc);
|
||||
auto [begin_file_id, begin] =
|
||||
source_manager.getDecomposedSpellingLoc(range.getBegin());
|
||||
auto [end_file_id, end] =
|
||||
source_manager.getDecomposedSpellingLoc(range.getEnd());
|
||||
return begin_file_id == file_id && end_file_id == file_id &&
|
||||
begin <= offset && offset < end;
|
||||
}
|
||||
|
||||
// Returns whether `diag_id` is a Clang diagnostic whose text is written as
|
||||
// `<what was considered>: <why it was not viable>`, with its first range
|
||||
// marking the source that second half is about.
|
||||
//
|
||||
// These are the overload-resolution candidate notes, and each one is listed
|
||||
// rather than being recognized by shape. Splitting on the first `: ` in any
|
||||
// note that happens to carry a range would cut the wrong messages in the wrong
|
||||
// place: a type or a path in the text supplies its own colon.
|
||||
//
|
||||
// TODO: Try to do this upstream instead. Clang has the structure here and
|
||||
// loses it: `DiagnoseBadConversion` and its siblings know which half is the
|
||||
// candidate and which is the reason, and know which argument the reason is
|
||||
// about, and then format both halves into one string. A note carrying its two
|
||||
// halves separately would serve Clang's own rendering as well, and would leave
|
||||
// nothing here to take apart. Until then this list has to be revisited
|
||||
// whenever the wording of one of these notes changes.
|
||||
static auto SplitsIntoCandidateAndReason(unsigned diag_id) -> bool {
|
||||
switch (diag_id) {
|
||||
case clang::diag::note_ovl_candidate_arity:
|
||||
case clang::diag::note_ovl_candidate_arity_one:
|
||||
case clang::diag::note_ovl_candidate_bad_base_to_derived_conv:
|
||||
case clang::diag::note_ovl_candidate_bad_conv:
|
||||
case clang::diag::note_ovl_candidate_bad_conv_incomplete:
|
||||
case clang::diag::note_ovl_candidate_bad_cvr:
|
||||
case clang::diag::note_ovl_candidate_bad_cvr_this:
|
||||
case clang::diag::note_ovl_candidate_bad_list_argument:
|
||||
case clang::diag::note_ovl_candidate_bad_value_category:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the parameter list of the declaration named at `loc`, which is what
|
||||
// a note marks when it has nothing of its own to mark.
|
||||
//
|
||||
// Clang leaves a function's parameter-list range empty when the function
|
||||
// declares no parameters, so a note about how many arguments it takes marks
|
||||
// nothing even though the list is written. The list is the parentheses after
|
||||
// the name, holding at most `void`, and it is where the count comes from.
|
||||
//
|
||||
// Returns an invalid range where those parentheses aren't right there: the name
|
||||
// may be an implicit function's, which has no list at all, or be followed by
|
||||
// template arguments, and reaching further would mark something that isn't the
|
||||
// list.
|
||||
static auto FindEmptyParameterList(const clang::SourceManager& source_manager,
|
||||
const clang::LangOptions& lang_opts,
|
||||
clang::SourceLocation loc)
|
||||
-> clang::CharSourceRange {
|
||||
if (loc.isInvalid() || loc.isMacroID()) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
// `operator()`'s name holds parentheses of its own, and the parameter list
|
||||
// is past them; the token after the name would be the name's `(`, not the
|
||||
// list's.
|
||||
clang::Token name;
|
||||
if (clang::Lexer::getRawToken(loc, name, source_manager, lang_opts,
|
||||
/*IgnoreWhiteSpace=*/true) ||
|
||||
(name.is(clang::tok::raw_identifier) &&
|
||||
name.getRawIdentifier() == "operator")) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
auto open = clang::Lexer::findNextToken(loc, source_manager, lang_opts);
|
||||
if (!open || !open->is(clang::tok::l_paren)) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
auto close = clang::Lexer::findNextToken(open->getLocation(), source_manager,
|
||||
lang_opts);
|
||||
// An empty list is written as `()` or as `(void)`. The lexing here is raw, so
|
||||
// `void` arrives as an identifier rather than as the keyword it is.
|
||||
if (close && close->is(clang::tok::raw_identifier) &&
|
||||
close->getRawIdentifier() == "void") {
|
||||
close = clang::Lexer::findNextToken(close->getLocation(), source_manager,
|
||||
lang_opts);
|
||||
}
|
||||
if (!close || !close->is(clang::tok::r_paren)) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
return clang::CharSourceRange::getCharRange(open->getLocation(),
|
||||
close->getEndLoc());
|
||||
}
|
||||
|
||||
// Returns the label to attach for a Clang note, which says more about the
|
||||
// diagnostic it follows rather than reporting a problem of its own.
|
||||
static auto GetNoteLabel() -> const Diagnostics::LabelBase<std::string>& {
|
||||
CARBON_DIAGNOSTIC_LABEL(CppInteropParseNote, Info, "{0}", std::string);
|
||||
return CppInteropParseNote;
|
||||
}
|
||||
|
||||
// Returns the label to attach for what a note says about the source it marks,
|
||||
// as opposed to the declaration the note names.
|
||||
static auto GetNoteReasonLabel() -> const Diagnostics::LabelBase<std::string>& {
|
||||
CARBON_DIAGNOSTIC_LABEL(CppInteropParseNoteReason, Info, "{0}", std::string);
|
||||
return CppInteropParseNoteReason;
|
||||
}
|
||||
|
||||
// Attaches what `info` marks: the ranges Clang would underline, which say
|
||||
// nothing the message doesn't and so only mark, and the changes it suggests,
|
||||
// which explain rather than state and so carry words.
|
||||
//
|
||||
// A range belonging to the leading diagnostic is part of the problem; one
|
||||
// belonging to a note explains it, the same as the note itself does.
|
||||
//
|
||||
// `to_loc` maps a Clang range onto whatever locations the builder takes.
|
||||
template <typename BuilderT, typename ToLocT>
|
||||
static auto AttachMarks(BuilderT& builder,
|
||||
const CppDiagnosticListener::Diagnostic& info,
|
||||
bool is_note, ToLocT to_loc) -> void {
|
||||
for (clang::CharSourceRange range : info.ranges) {
|
||||
builder.Attach(to_loc(range), is_note
|
||||
? Diagnostics::LabelCategory::Info
|
||||
: Diagnostics::LabelCategory::Primary);
|
||||
}
|
||||
for (const CppDiagnosticListener::FixIt& fix_it : info.fix_its) {
|
||||
AttachFixIt(builder, to_loc(fix_it.range), fix_it);
|
||||
}
|
||||
}
|
||||
|
||||
// Attaches `note_info`, a note trailing the diagnostic being built: its words
|
||||
// on the declaration it names, its reason half -- when it split into one --
|
||||
// on the source that half is about, and then whatever it marks.
|
||||
template <typename BuilderT, typename ToLocT>
|
||||
static auto AttachNote(BuilderT& builder,
|
||||
const CppDiagnosticListener::Diagnostic& note_info,
|
||||
ToLocT to_loc) -> void {
|
||||
builder.Attach(to_loc(note_info.location), GetNoteLabel(), note_info.message);
|
||||
if (!note_info.reason.empty()) {
|
||||
builder.Attach(to_loc(note_info.reason_range), GetNoteReasonLabel(),
|
||||
note_info.reason);
|
||||
}
|
||||
AttachMarks(builder, note_info, /*is_note=*/true, to_loc);
|
||||
}
|
||||
|
||||
// A listener that emits Clang diagnostics directly to a provided Carbon
|
||||
// Diagnostics::Consumer when no Carbon Context is active.
|
||||
class FallbackDiagnosticListener : public CppDiagnosticListener {
|
||||
@@ -97,19 +278,16 @@ class FallbackDiagnosticListener : public CppDiagnosticListener {
|
||||
}
|
||||
ClangLocDiagnosticEmitter emitter(carbon_consumer_,
|
||||
diags[0].source_manager);
|
||||
auto as_range = [](clang::CharSourceRange range) { return range; };
|
||||
for (size_t i = 0; i != diags.size(); ++i) {
|
||||
const Diagnostic& info = diags[i];
|
||||
auto builder =
|
||||
emitter.Build(info.location, GetDiagnostic(info.level), info.message);
|
||||
builder.OverrideSnippet(info.snippet);
|
||||
AttachMarks(builder, info, /*is_note=*/false, as_range);
|
||||
for (; i + 1 < diags.size() &&
|
||||
diags[i + 1].level == clang::DiagnosticsEngine::Note;
|
||||
++i) {
|
||||
const Diagnostic& note_info = diags[i + 1];
|
||||
builder
|
||||
.Note(note_info.location, GetDiagnostic(note_info.level),
|
||||
note_info.message)
|
||||
.OverrideSnippet(note_info.snippet);
|
||||
AttachNote(builder, diags[i + 1], as_range);
|
||||
}
|
||||
builder.Emit();
|
||||
}
|
||||
@@ -142,17 +320,14 @@ class ContextDiagnosticListener : public CppDiagnosticListener {
|
||||
auto builder =
|
||||
context_->emitter().Build(SemIR::LocId(import_ir_inst_id),
|
||||
GetDiagnostic(info.level), info.message);
|
||||
builder.OverrideSnippet(info.snippet);
|
||||
auto as_loc_id = [&](clang::CharSourceRange range) {
|
||||
return SemIR::LocId(AddImportIRInst(context_->sem_ir(), range));
|
||||
};
|
||||
AttachMarks(builder, info, /*is_note=*/false, as_loc_id);
|
||||
for (; i + 1 < diags.size() &&
|
||||
diags[i + 1].level == clang::DiagnosticsEngine::Note;
|
||||
++i) {
|
||||
const Diagnostic& note_info = diags[i + 1];
|
||||
SemIR::ImportIRInstId note_import_ir_inst_id =
|
||||
AddImportIRInst(context_->sem_ir(), note_info.location);
|
||||
builder
|
||||
.Note(SemIR::LocId(note_import_ir_inst_id),
|
||||
GetDiagnostic(note_info.level), note_info.message)
|
||||
.OverrideSnippet(note_info.snippet);
|
||||
AttachNote(builder, diags[i + 1], as_loc_id);
|
||||
}
|
||||
// TODO: This will apply all current Carbon annotation functions. We
|
||||
// should instead track how Clang's context notes and Carbon's annotation
|
||||
@@ -227,63 +402,118 @@ class CarbonClangDiagnosticConsumer : public clang::DiagnosticConsumer {
|
||||
llvm::SmallString<256> message;
|
||||
info.FormatDiagnostic(message);
|
||||
|
||||
// Render a code snippet including any highlighted ranges and fixit hints.
|
||||
// TODO: Also include the #include stack and macro expansion stack in the
|
||||
// diagnostic output in some way.
|
||||
RawStringOstream snippet_stream;
|
||||
if (!info.hasSourceManager()) {
|
||||
// If we don't have a source manager, this is an error from early in the
|
||||
// frontend. Don't produce a snippet.
|
||||
CARBON_CHECK(info.getLocation().isInvalid());
|
||||
} else {
|
||||
CodeContextRenderer(snippet_stream, invocation_->getLangOpts(),
|
||||
invocation_->getDiagnosticOpts())
|
||||
.emitDiagnostic(
|
||||
clang::FullSourceLoc(info.getLocation(), info.getSourceManager()),
|
||||
diag_level, message, info.getRanges(), info.getFixItHints());
|
||||
}
|
||||
|
||||
// What Clang would underline and what it suggests changing, kept as ranges
|
||||
// rather than as text: the toolchain marks and labels them itself, so that
|
||||
// a diagnostic from C++ reads like one from Carbon. The `#include` and
|
||||
// macro-expansion stacks reach the location as `included from` and
|
||||
// `expanded from macro defined at` steps, drawn like any other path a
|
||||
// location was reached by.
|
||||
const clang::SourceManager* source_manager =
|
||||
info.hasSourceManager() ? &info.getSourceManager() : nullptr;
|
||||
|
||||
// Clang's token ranges reach to the start of their last token rather than
|
||||
// past it, so they are widened here. Everything downstream then measures a
|
||||
// range by subtracting its ends, and an empty one is an insertion point
|
||||
// rather than a range that happens to name one token.
|
||||
auto as_char_range = [&](clang::CharSourceRange range) {
|
||||
if (!source_manager) {
|
||||
return range;
|
||||
}
|
||||
return clang::Lexer::getAsCharRange(range, *source_manager,
|
||||
invocation_->getLangOpts());
|
||||
};
|
||||
llvm::SmallVector<clang::CharSourceRange, 2> ranges;
|
||||
for (clang::CharSourceRange range : info.getRanges()) {
|
||||
ranges.push_back(as_char_range(range));
|
||||
}
|
||||
llvm::SmallVector<CppDiagnosticListener::FixIt, 0> fix_its;
|
||||
for (const clang::FixItHint& hint : info.getFixItHints()) {
|
||||
// A hint copying code from elsewhere carries it in `InsertFromRange`,
|
||||
// which nothing here reads; presented as the removal its empty
|
||||
// `CodeToInsert` looks like, it would instruct the opposite edit.
|
||||
// TODO: Map such a hint to an insertion of the text `InsertFromRange`
|
||||
// names.
|
||||
if (hint.isNull() || hint.InsertFromRange.isValid()) {
|
||||
continue;
|
||||
}
|
||||
// Widening fails for a token range ending inside a macro; Clang's own
|
||||
// rendering drops such a fix-it too.
|
||||
clang::CharSourceRange range = as_char_range(hint.RemoveRange);
|
||||
if (range.isInvalid()) {
|
||||
continue;
|
||||
}
|
||||
fix_its.push_back({.range = range, .text = hint.CodeToInsert});
|
||||
}
|
||||
|
||||
// A Clang location names a point, and is marked as the one column Clang's
|
||||
// own caret marks. How far it reaches is said only by a range attached
|
||||
// alongside it, and a location can name the middle of a token, as one in
|
||||
// a format string does.
|
||||
clang::SourceLocation begin = info.getLocation();
|
||||
clang::CharSourceRange location =
|
||||
clang::CharSourceRange::getCharRange(begin, begin);
|
||||
|
||||
// Clang draws a range holding the caret as part of the caret's own mark
|
||||
// rather than beside it -- the `~~~~` of a `^~~~~` -- so such a range is
|
||||
// what the message is about rather than something else it points at. The
|
||||
// rest stay marks of their own.
|
||||
//
|
||||
// TODO: Also mark where the caret is within the range, as Clang's
|
||||
// `~~~^~~~` does. That needs the renderer to be able to mark a point
|
||||
// inside a range it underlines.
|
||||
if (source_manager && begin.isValid()) {
|
||||
auto* found = llvm::find_if(ranges, [&](clang::CharSourceRange range) {
|
||||
return Contains(*source_manager, range, begin);
|
||||
});
|
||||
if (found != ranges.end()) {
|
||||
location = *found;
|
||||
ranges.erase(found);
|
||||
}
|
||||
}
|
||||
|
||||
if (!source_manager) {
|
||||
// Without a source manager this is an error from early in the frontend,
|
||||
// and there is nothing to mark.
|
||||
CARBON_CHECK(info.getLocation().isInvalid());
|
||||
ranges.clear();
|
||||
fix_its.clear();
|
||||
}
|
||||
|
||||
// A note that says one thing about the declaration it names and another
|
||||
// about the source it marks becomes a label on each, rather than one
|
||||
// sentence hung off the name. Which notes are written that way is stated
|
||||
// by `SplitsIntoCandidateAndReason` rather than guessed at from the text.
|
||||
llvm::StringRef head = message.str();
|
||||
llvm::StringRef reason;
|
||||
clang::CharSourceRange reason_range;
|
||||
if (source_manager && SplitsIntoCandidateAndReason(info.getID()) &&
|
||||
!ranges.empty()) {
|
||||
if (ranges.front().isInvalid()) {
|
||||
ranges.front() = FindEmptyParameterList(
|
||||
*source_manager, invocation_->getLangOpts(), begin);
|
||||
}
|
||||
auto [before, after] = head.split(": ");
|
||||
if (ranges.front().isValid() && !after.empty()) {
|
||||
head = before;
|
||||
reason = after;
|
||||
reason_range = ranges.front();
|
||||
ranges.erase(ranges.begin());
|
||||
}
|
||||
}
|
||||
llvm::erase_if(
|
||||
ranges, [](clang::CharSourceRange range) { return range.isInvalid(); });
|
||||
|
||||
diagnostic_infos_.push_back({.level = diag_level,
|
||||
.location = info.getLocation(),
|
||||
.location = location,
|
||||
.source_manager = source_manager,
|
||||
.message = message.str().str(),
|
||||
.snippet = snippet_stream.TakeStr()});
|
||||
.message = head.str(),
|
||||
.reason = reason.str(),
|
||||
.reason_range = reason_range,
|
||||
.ranges = std::move(ranges),
|
||||
.fix_its = std::move(fix_its)});
|
||||
}
|
||||
|
||||
private:
|
||||
// A diagnostics renderer based on clang's TextDiagnostic that captures just
|
||||
// the code context (the snippet).
|
||||
class CodeContextRenderer : public clang::TextDiagnostic {
|
||||
protected:
|
||||
using TextDiagnostic::TextDiagnostic;
|
||||
|
||||
void emitDiagnosticMessage(
|
||||
clang::FullSourceLoc /*loc*/, clang::PresumedLoc /*ploc*/,
|
||||
clang::DiagnosticsEngine::Level /*level*/, llvm::StringRef /*message*/,
|
||||
llvm::ArrayRef<clang::CharSourceRange> /*ranges*/,
|
||||
clang::DiagOrStoredDiag /*info*/) override {}
|
||||
void emitDiagnosticLoc(
|
||||
clang::FullSourceLoc /*loc*/, clang::PresumedLoc /*ploc*/,
|
||||
clang::DiagnosticsEngine::Level /*level*/,
|
||||
llvm::ArrayRef<clang::CharSourceRange> /*ranges*/) override {}
|
||||
|
||||
// emitCodeContext is inherited from clang::TextDiagnostic.
|
||||
|
||||
void emitIncludeLocation(clang::FullSourceLoc /*loc*/,
|
||||
clang::PresumedLoc /*ploc*/) override {}
|
||||
void emitImportLocation(clang::FullSourceLoc /*loc*/,
|
||||
clang::PresumedLoc /*ploc*/,
|
||||
llvm::StringRef /*module_name*/) override {}
|
||||
void emitBuildingModuleLocation(clang::FullSourceLoc /*loc*/,
|
||||
clang::PresumedLoc /*ploc*/,
|
||||
llvm::StringRef /*module_name*/) override {}
|
||||
|
||||
// beginDiagnostic and endDiagnostic are inherited from
|
||||
// clang::TextDiagnostic in case it wants to do any setup / teardown work.
|
||||
};
|
||||
|
||||
llvm::SmallVector<CppDiagnosticListener::Diagnostic> diagnostic_infos_;
|
||||
llvm::SmallVector<CppDiagnosticListener*, 2> listeners_;
|
||||
FallbackDiagnosticListener fallback_listener_;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
namespace clang {
|
||||
class SourceManager;
|
||||
@@ -26,12 +27,34 @@ class CarbonClangDiagnosticConsumer;
|
||||
// itself on destruction.
|
||||
class CppDiagnosticListener {
|
||||
public:
|
||||
// A change Clang suggests: what to put in `range`, which is empty for an
|
||||
// insertion and where `text` is empty for a deletion.
|
||||
struct FixIt {
|
||||
clang::CharSourceRange range;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct Diagnostic {
|
||||
clang::DiagnosticsEngine::Level level;
|
||||
clang::SourceLocation location;
|
||||
// Where the diagnostic points: the one column its location names, or the
|
||||
// range holding that column when one was attached, which Clang draws as
|
||||
// the caret's own `^~~~`.
|
||||
clang::CharSourceRange location;
|
||||
const clang::SourceManager* source_manager = nullptr;
|
||||
std::string message;
|
||||
std::string snippet;
|
||||
// What a note says about `reason_range` rather than about the declaration
|
||||
// it names, split off from `message`, or empty for a note that says only
|
||||
// one thing. Clang words a candidate note as "<which candidate>: <what is
|
||||
// wrong with it>" and marks the source the second half is about, which is
|
||||
// two labels here rather than one sentence hung off the name.
|
||||
std::string reason;
|
||||
clang::CharSourceRange reason_range;
|
||||
// What Clang would underline, which becomes the ranges the diagnostic
|
||||
// marks. Clang's own rendering of them is not kept: the toolchain draws
|
||||
// these the way it draws its own. `reason_range` is not among them, since
|
||||
// it carries words instead.
|
||||
llvm::SmallVector<clang::CharSourceRange, 2> ranges;
|
||||
llvm::SmallVector<FixIt, 0> fix_its;
|
||||
};
|
||||
|
||||
explicit CppDiagnosticListener(CarbonClangDiagnosticConsumer& consumer);
|
||||
|
||||
@@ -1647,12 +1647,13 @@ auto ExportFunctionToCppPointerConversion(
|
||||
ExportedFunctionPtrTypeMismatch, Error,
|
||||
"can't convert exported {0:member |}function pointer to `{1}`",
|
||||
Diagnostics::BoolAsSelect, CppType);
|
||||
CARBON_DIAGNOSTIC(ExportedFromFunction, Note,
|
||||
"function exported with pointer type `{0}`", CppType);
|
||||
CARBON_DIAGNOSTIC_LABEL(ExportedFromFunction, Info,
|
||||
"function exported with pointer type `{0}`",
|
||||
CppType);
|
||||
context.emitter()
|
||||
.Build(src_id, ExportedFunctionPtrTypeMismatch,
|
||||
src_ptr_type->isMemberFunctionPointerType(), dest_ptr_type)
|
||||
.Note(function.first_decl_id(), ExportedFromFunction, src_ptr_type)
|
||||
.Attach(function.first_decl_id(), ExportedFromFunction, src_ptr_type)
|
||||
.Emit();
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -147,10 +147,11 @@ static auto BuildCopyWitness(Context& context, SemIR::LocId loc_id,
|
||||
auto class_type_id = SemIR::TypeId::ForTypeConstant(query_self_const_id);
|
||||
if (!Check::RequireCompleteType(
|
||||
context, class_type_id, SemIR::LocId::None, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInCopyWitness, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInCopyWitness,
|
||||
"argument to C++ call has incomplete type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, IncompleteTypeInCopyWitness,
|
||||
builder.Attach(loc_id, IncompleteTypeInCopyWitness,
|
||||
class_type_id);
|
||||
})) {
|
||||
return SemIR::ErrorInst::InstId;
|
||||
|
||||
@@ -2071,9 +2071,9 @@ static auto ImportFunctionDecl(Context& context, SemIR::LocId loc_id,
|
||||
if (IsCppThunkRequired(context, callee_info)) {
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InCppThunk, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(InCppThunk, Info,
|
||||
"in thunk for C++ function used here");
|
||||
builder.Note(loc_id, InCppThunk);
|
||||
builder.Attach(loc_id, InCppThunk);
|
||||
});
|
||||
DefineAsThunkCall(context, loc_id, callee_info, imported_function);
|
||||
} else {
|
||||
@@ -2138,9 +2138,10 @@ auto ImportFunctionPointerInvoke(
|
||||
}
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InCppFunctionPointerThunk, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
InCppFunctionPointerThunk, Info,
|
||||
"in thunk for C++ function pointer type used here");
|
||||
builder.Note(loc_id, InCppFunctionPointerThunk);
|
||||
builder.Attach(loc_id, InCppFunctionPointerThunk);
|
||||
});
|
||||
|
||||
CppCalleeFunctionInfo callee_info(context, info.clang_type);
|
||||
@@ -2744,9 +2745,10 @@ auto ImportNameFromCpp(Context& context, SemIR::LocId loc_id,
|
||||
-> SemIR::ScopeLookupResult {
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InCppNameLookup, Note,
|
||||
"in `Cpp` name lookup for `{0}`", SemIR::NameId);
|
||||
builder.Note(loc_id, InCppNameLookup, name_id);
|
||||
CARBON_DIAGNOSTIC_LABEL(InCppNameLookup, Info,
|
||||
"in `Cpp` name lookup for `{0}`",
|
||||
SemIR::NameId);
|
||||
builder.Attach(loc_id, InCppNameLookup, name_id);
|
||||
});
|
||||
if (IsIncompleteClass(context, scope_id)) {
|
||||
return SemIR::ScopeLookupResult::MakeError();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "toolchain/lex/tokenized_buffer.h"
|
||||
#include "toolchain/sem_ir/absolute_node_ref.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
|
||||
@@ -68,8 +69,10 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id)
|
||||
SemIR::GetAbsoluteNodeRef(&context.sem_ir(), loc_id);
|
||||
const auto& final_node = absolute_node_refs.back();
|
||||
if (final_node.is_cpp()) {
|
||||
return final_node.file()->clang_source_locs().Get(
|
||||
final_node.clang_source_loc_id());
|
||||
return final_node.file()
|
||||
->clang_source_locs()
|
||||
.Get(final_node.clang_source_loc_id())
|
||||
.getBegin();
|
||||
}
|
||||
|
||||
if (!final_node.node_id().has_value()) {
|
||||
@@ -88,11 +91,55 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id)
|
||||
return start_loc.getLocWithOffset(offset);
|
||||
}
|
||||
|
||||
auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc)
|
||||
auto GetCppRange(Context& context, SemIR::LocId loc_id)
|
||||
-> clang::CharSourceRange {
|
||||
if (!context.sem_ir().cpp_file()) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
|
||||
llvm::SmallVector<SemIR::AbsoluteNodeRef> absolute_node_refs =
|
||||
SemIR::GetAbsoluteNodeRef(&context.sem_ir(), loc_id);
|
||||
const auto& final_node = absolute_node_refs.back();
|
||||
if (final_node.is_cpp()) {
|
||||
auto loc = GetCppLocation(context, loc_id);
|
||||
return clang::CharSourceRange::getTokenRange(loc, loc);
|
||||
}
|
||||
if (!final_node.node_id().has_value()) {
|
||||
return clang::CharSourceRange();
|
||||
}
|
||||
|
||||
auto [ir, start_loc] = GetFileInfo(context, final_node.check_ir_id());
|
||||
const auto& tokens = ir->parse_tree().tokens();
|
||||
auto token = ir->parse_tree().node_token(final_node.node_id());
|
||||
// Only the file being checked has its subtrees available, since a `Context`
|
||||
// holds the one `TreeAndSubtrees`.
|
||||
Lex::InclusiveTokenRange token_range = {.begin = token, .end = token};
|
||||
if (final_node.check_ir_id() == context.sem_ir().check_ir_id()) {
|
||||
token_range = context.parse_tree_and_subtrees().GetSubtreeTokenRange(
|
||||
final_node.node_id());
|
||||
}
|
||||
return clang::CharSourceRange::getCharRange(
|
||||
start_loc.getLocWithOffset(tokens.GetByteOffset(token_range.begin)),
|
||||
start_loc.getLocWithOffset(tokens.GetByteOffset(token_range.end) +
|
||||
tokens.GetTokenText(token_range.end).size()));
|
||||
}
|
||||
|
||||
auto AddImportIRInst(SemIR::File& file, clang::CharSourceRange clang_range)
|
||||
-> SemIR::ImportIRInstId {
|
||||
// Stored as its two ends: every range reaching here is a character range, so
|
||||
// `CharSourceRange`'s token-or-character bit would always say the same thing
|
||||
// and cost a word to say it. Rebuilt as one where it is read.
|
||||
CARBON_CHECK(!clang_range.isTokenRange(),
|
||||
"A token range would lose which it was; widen it first.");
|
||||
SemIR::ClangSourceLocId clang_source_loc_id =
|
||||
file.clang_source_locs().Add(clang_source_loc);
|
||||
file.clang_source_locs().Add(clang_range.getAsRange());
|
||||
return file.import_ir_insts().Add(SemIR::ImportIRInst(clang_source_loc_id));
|
||||
}
|
||||
|
||||
auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc)
|
||||
-> SemIR::ImportIRInstId {
|
||||
return AddImportIRInst(file, clang::CharSourceRange::getCharRange(
|
||||
clang_source_loc, clang_source_loc));
|
||||
}
|
||||
|
||||
} // namespace Carbon::Check
|
||||
@@ -14,8 +14,26 @@ namespace Carbon::Check {
|
||||
auto GetCppLocation(Context& context, SemIR::LocId loc_id)
|
||||
-> clang::SourceLocation;
|
||||
|
||||
// Adds an `ImportIRInst` referring to the given source location and returns a
|
||||
// corresponding `ImportIRInstId` that can be used to construct a `LocId`.
|
||||
// Maps a Carbon source location into the Clang range covering the source a
|
||||
// Carbon diagnostic marked with it would underline, which is everything the
|
||||
// node spans rather than the one token it names.
|
||||
//
|
||||
// In Carbon source this is a character range, since Clang finds the end of a
|
||||
// token range by lexing the token there as C++. Only the file being checked has
|
||||
// its subtrees available, so a location in an imported file gives the range of
|
||||
// the one token `GetCppLocation` names. A location that is already in C++ gives
|
||||
// a token range at that token, which Clang can measure.
|
||||
auto GetCppRange(Context& context, SemIR::LocId loc_id)
|
||||
-> clang::CharSourceRange;
|
||||
|
||||
// Adds an `ImportIRInst` referring to the given source range and returns a
|
||||
// corresponding `ImportIRInstId` that can be used to construct a `LocId`. The
|
||||
// range is what a diagnostic marking the location underlines.
|
||||
auto AddImportIRInst(SemIR::File& file, clang::CharSourceRange clang_range)
|
||||
-> SemIR::ImportIRInstId;
|
||||
|
||||
// The same for a Clang location, which is a point and marks the one column it
|
||||
// names.
|
||||
auto AddImportIRInst(SemIR::File& file, clang::SourceLocation clang_source_loc)
|
||||
-> SemIR::ImportIRInstId;
|
||||
|
||||
|
||||
@@ -673,11 +673,11 @@ struct DiagnoseIncompleteOperandTypeInCppOperatorLookup {
|
||||
SemIR::LocId loc_id;
|
||||
|
||||
void operator()(auto& builder) const {
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncompleteOperandTypeInCppOperatorLookup, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteOperandTypeInCppOperatorLookup,
|
||||
"looking up a C++ operator with incomplete operand type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, IncompleteOperandTypeInCppOperatorLookup,
|
||||
builder.Attach(loc_id, IncompleteOperandTypeInCppOperatorLookup,
|
||||
arg_type_id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -263,7 +263,7 @@ auto ComputeClangDeclSignatureFromBestViableFunction(
|
||||
}
|
||||
|
||||
auto PerformCppOverloadResolution(
|
||||
Context& context, SemIR::LocId loc_id,
|
||||
Context& context, SemIR::LocId loc_id, SemIR::InstId callee_expr_id,
|
||||
const SemIR::CppOverloadSet& overload_set,
|
||||
llvm::ArrayRef<SemIR::InstId> template_arg_ids, SemIR::InstId self_id,
|
||||
llvm::ArrayRef<SemIR::InstId> arg_ids) -> SemIR::InstId {
|
||||
@@ -287,7 +287,13 @@ auto PerformCppOverloadResolution(
|
||||
}
|
||||
auto& arg_exprs = *maybe_arg_exprs;
|
||||
|
||||
clang::SourceLocation loc = GetCppLocation(context, loc_id);
|
||||
// What a diagnostic about the call marks is the callee, not the call: the
|
||||
// message names the callee, and the arguments it was given are described by
|
||||
// the notes hanging off each candidate. This is where Clang points such a
|
||||
// diagnostic too.
|
||||
clang::CharSourceRange callee_range =
|
||||
GetCppRange(context, SemIR::LocId(callee_expr_id));
|
||||
clang::SourceLocation loc = callee_range.getBegin();
|
||||
|
||||
// Add candidate functions from the name lookup.
|
||||
const auto& rewrite_info = overload_set.operator_rewrite_info;
|
||||
@@ -332,7 +338,8 @@ auto PerformCppOverloadResolution(
|
||||
candidate_set.NoteCandidates(
|
||||
clang::PartialDiagnosticAt(
|
||||
loc, sema.PDiag(clang::diag::err_ovl_no_viable_function_in_call)
|
||||
<< GetCppName(context, overload_set.name_id)),
|
||||
<< GetCppName(context, overload_set.name_id)
|
||||
<< callee_range),
|
||||
sema, clang::OCD_AllCandidates, arg_exprs);
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
@@ -340,15 +347,27 @@ auto PerformCppOverloadResolution(
|
||||
candidate_set.NoteCandidates(
|
||||
clang::PartialDiagnosticAt(
|
||||
loc, sema.PDiag(clang::diag::err_ovl_ambiguous_call)
|
||||
<< GetCppName(context, overload_set.name_id)),
|
||||
<< GetCppName(context, overload_set.name_id)
|
||||
<< callee_range),
|
||||
sema, clang::OCD_AmbiguousCandidates, arg_exprs);
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
case clang::OverloadingResult::OR_Deleted: {
|
||||
sema.DiagnoseUseOfDeletedFunction(
|
||||
loc, clang::SourceRange(loc, loc),
|
||||
GetCppName(context, overload_set.name_id), candidate_set,
|
||||
best_viable_fn->Function, arg_exprs);
|
||||
// This is what `Sema::DiagnoseUseOfDeletedFunction` emits. That takes the
|
||||
// callee's range as a `SourceRange`, whose end Clang would find by lexing
|
||||
// the last Carbon token as C++.
|
||||
clang::StringLiteral* deleted_message =
|
||||
best_viable_fn->Function->getDeletedMessage();
|
||||
candidate_set.NoteCandidates(
|
||||
clang::PartialDiagnosticAt(
|
||||
loc, sema.PDiag(clang::diag::err_ovl_deleted_call)
|
||||
<< /*IsMember=*/false
|
||||
<< GetCppName(context, overload_set.name_id)
|
||||
<< (deleted_message != nullptr)
|
||||
<< (deleted_message ? deleted_message->getString()
|
||||
: llvm::StringRef())
|
||||
<< callee_range),
|
||||
sema, clang::OCD_AllCandidates, arg_exprs);
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,17 @@ auto ComputeClangDeclSignatureFromBestViableFunction(
|
||||
// instruction referring to that function, or an error instruction if overload
|
||||
// resolution failed.
|
||||
//
|
||||
// `callee_expr_id` is the expression naming the overload set, which is what a
|
||||
// diagnostic about the resolution marks: the message names the callee, and what
|
||||
// each candidate was given is described by the note hanging off it.
|
||||
//
|
||||
// A set with a single non-templated function goes through the same rules for
|
||||
// overload resolution. This is to make sure that calls that have no viable
|
||||
// implicit conversion sequence are rejected even when an implicit conversion is
|
||||
// possible. Keeping the same behavior here for consistency and supporting
|
||||
// migrations so that the migrated callers from C++ remain valid.
|
||||
auto PerformCppOverloadResolution(
|
||||
Context& context, SemIR::LocId loc_id,
|
||||
Context& context, SemIR::LocId loc_id, SemIR::InstId callee_expr_id,
|
||||
const SemIR::CppOverloadSet& overload_set,
|
||||
llvm::ArrayRef<SemIR::InstId> template_arg_ids, SemIR::InstId self_id,
|
||||
llvm::ArrayRef<SemIR::InstId> arg_ids) -> SemIR::InstId;
|
||||
|
||||
@@ -393,10 +393,10 @@ static auto DiagnoseQualifiedDeclInIncompleteClassScope(Context& context,
|
||||
-> void {
|
||||
Diagnostics::ContextScope diagnostic_context(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(QualifiedDeclInIncompleteClassScope, Context,
|
||||
"cannot declare a member of incomplete class {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, QualifiedDeclInIncompleteClassScope,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
QualifiedDeclInIncompleteClassScope,
|
||||
"cannot declare a member of incomplete class {0}", SemIR::TypeId);
|
||||
builder.Attach(loc_id, QualifiedDeclInIncompleteClassScope,
|
||||
context.classes().Get(class_id).self_type_id);
|
||||
});
|
||||
DiagnoseIncompleteClass(context, class_id);
|
||||
@@ -409,10 +409,10 @@ static auto DiagnoseQualifiedDeclInUndefinedInterfaceScope(
|
||||
SemIR::InstId interface_inst_id) -> void {
|
||||
Diagnostics::ContextScope diagnostic_context(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(QualifiedDeclInUndefinedInterfaceScope, Context,
|
||||
"cannot declare a member of undefined interface {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(loc_id, QualifiedDeclInUndefinedInterfaceScope,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
QualifiedDeclInUndefinedInterfaceScope,
|
||||
"cannot declare a member of undefined interface {0}", InstIdAsType);
|
||||
builder.Attach(loc_id, QualifiedDeclInUndefinedInterfaceScope,
|
||||
interface_inst_id);
|
||||
});
|
||||
DiagnoseIncompleteInterface(context, interface_id);
|
||||
@@ -426,11 +426,11 @@ static auto DiagnoseQualifiedDeclInImportedPackage(Context& context,
|
||||
-> void {
|
||||
CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackage, Error,
|
||||
"imported packages cannot be used for declarations");
|
||||
CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackageSource, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(QualifiedDeclOutsidePackageSource, Info,
|
||||
"package imported here");
|
||||
context.emitter()
|
||||
.Build(use_loc_id, QualifiedDeclOutsidePackage)
|
||||
.Note(import_loc_id, QualifiedDeclOutsidePackageSource)
|
||||
.Attach(import_loc_id, QualifiedDeclOutsidePackageSource)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -442,11 +442,11 @@ static auto DiagnoseQualifiedDeclInNonScope(
|
||||
CARBON_DIAGNOSTIC(QualifiedNameInNonScope, Error,
|
||||
"name qualifiers are only allowed for entities that "
|
||||
"provide a scope");
|
||||
CARBON_DIAGNOSTIC(QualifiedNameNonScopeEntity, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(QualifiedNameNonScopeEntity, Info,
|
||||
"referenced non-scope entity declared here");
|
||||
context.emitter()
|
||||
.Build(use_loc_id, QualifiedNameInNonScope)
|
||||
.Note(non_scope_entity_loc_id, QualifiedNameNonScopeEntity)
|
||||
.Attach(non_scope_entity_loc_id, QualifiedNameNonScopeEntity)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
|
||||
@@ -213,10 +213,11 @@ class DeductionContext {
|
||||
auto& builder) -> void {
|
||||
if (auto param = context().insts().TryGetAs<SemIR::SymbolicBindingPattern>(
|
||||
param_id)) {
|
||||
CARBON_DIAGNOSTIC(InitializingGenericParam, Note,
|
||||
"initializing generic parameter `{0}` declared here",
|
||||
SemIR::NameId);
|
||||
builder.Note(loc_id, InitializingGenericParam,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
InitializingGenericParam, Info,
|
||||
"initializing generic parameter `{0}` declared here", SemIR::NameId);
|
||||
builder.Attach(
|
||||
loc_id, InitializingGenericParam,
|
||||
context().entity_names().Get(param->entity_name_id).name_id);
|
||||
} else {
|
||||
NoteGenericHere(context(), generic_id_, builder);
|
||||
@@ -241,9 +242,9 @@ class DeductionContext {
|
||||
|
||||
static auto NoteGenericHere(Context& context, SemIR::GenericId generic_id,
|
||||
DiagnosticBuilder& diag) -> void {
|
||||
CARBON_DIAGNOSTIC(DeductionGenericHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(DeductionGenericHere, Info,
|
||||
"while deducing parameters of generic declared here");
|
||||
diag.Note(context.generics().Get(generic_id).decl_id, DeductionGenericHere);
|
||||
diag.Attach(context.generics().Get(generic_id).decl_id, DeductionGenericHere);
|
||||
}
|
||||
|
||||
DeductionContext::DeductionContext(Context* context, SemIR::LocId loc_id,
|
||||
@@ -549,11 +550,11 @@ auto DeductionContext::CheckDeductionIsComplete() -> bool {
|
||||
{
|
||||
Diagnostics::ContextScope diag_context(
|
||||
&context().emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
SubstitutingGenericParamType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
SubstitutingGenericParamType,
|
||||
"constructed invalid specific for {0} from argument",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id_, SubstitutingGenericParamType,
|
||||
builder.Attach(loc_id_, SubstitutingGenericParamType,
|
||||
binding_type_id);
|
||||
});
|
||||
auto param_type_const_id =
|
||||
|
||||
@@ -24,26 +24,28 @@ auto DiagnosticEmitter::ConvertLoc(LocIdForDiagnostics loc_id,
|
||||
auto [imports, converted] = loc_converter_.ConvertWithImports(
|
||||
loc_id.loc_id(), loc_id.is_token_only());
|
||||
for (const auto& import : imports) {
|
||||
CARBON_DIAGNOSTIC(InImport, LocationInfo, "in import");
|
||||
CARBON_DIAGNOSTIC(InCppInclude, LocationInfo, "in file included here");
|
||||
CARBON_DIAGNOSTIC(InCppModule, LocationInfo, "in module imported here");
|
||||
CARBON_DIAGNOSTIC(InCppMacroExpansion, LocationInfo,
|
||||
"in expansion of macro defined here");
|
||||
// These are rendered as `<text>: <location>`, hanging off the location
|
||||
// they were reached from, so each reads as a step in a path.
|
||||
CARBON_DIAGNOSTIC_LOCATION_INFO(InImport, "imported from");
|
||||
CARBON_DIAGNOSTIC_LOCATION_INFO(InCppInclude, "included from");
|
||||
CARBON_DIAGNOSTIC_LOCATION_INFO(InCppModule, "imported from module at");
|
||||
CARBON_DIAGNOSTIC_LOCATION_INFO(InCppMacroExpansion,
|
||||
"expanded from macro defined at");
|
||||
switch (import.kind) {
|
||||
case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::Import:
|
||||
// TODO: Include the library name in the note.
|
||||
// TODO: Include the library name in the label.
|
||||
context_fn(import.loc, InImport);
|
||||
break;
|
||||
case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppInclude:
|
||||
// TODO: Include the file name in the note.
|
||||
// TODO: Include the file name in the label.
|
||||
context_fn(import.loc, InCppInclude);
|
||||
break;
|
||||
case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppModuleImport:
|
||||
// TODO: Include the module name in the note.
|
||||
// TODO: Include the module name in the label.
|
||||
context_fn(import.loc, InCppModule);
|
||||
break;
|
||||
case Carbon::SemIR::DiagnosticLocConverter::ImportLoc::CppMacroExpansion:
|
||||
// TODO: Include the macro name in the note.
|
||||
// TODO: Include the macro name in the label.
|
||||
// TODO: Include the Clang-generated snippet here rather than with the
|
||||
// main diagnostic.
|
||||
context_fn(import.loc, InCppMacroExpansion);
|
||||
|
||||
@@ -51,7 +51,7 @@ using DiagnosticEmitterBase = Diagnostics::Emitter<LocIdForDiagnostics>;
|
||||
using DiagnosticBuilder = DiagnosticEmitterBase::Builder;
|
||||
using DiagnosticContextBuilder = DiagnosticEmitterBase::ContextBuilder;
|
||||
|
||||
// A function that adds a Context message for a diagnostic.
|
||||
// A function that adds a context label to a diagnostic.
|
||||
using DiagnosticContextFn =
|
||||
llvm::function_ref<auto(DiagnosticContextBuilder&)->void>;
|
||||
|
||||
|
||||
@@ -3019,13 +3019,13 @@ static auto MakeConstantForCall(EvalContext& eval_context,
|
||||
evaluation_mode == SemIR::Function::EvaluationMode::MustEval) {
|
||||
CARBON_DIAGNOSTIC(NonConstantCallToCompTimeOnlyFunction, Error,
|
||||
"non-constant call to compile-time-only function");
|
||||
CARBON_DIAGNOSTIC(CompTimeOnlyFunctionHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(CompTimeOnlyFunctionHere, Info,
|
||||
"compile-time-only function declared here");
|
||||
const auto& function = eval_context.functions().Get(
|
||||
std::get<SemIR::CalleeFunction>(callee).function_id);
|
||||
eval_context.emitter()
|
||||
.Build(inst_id, NonConstantCallToCompTimeOnlyFunction)
|
||||
.Note(function.latest_decl_id(), CompTimeOnlyFunctionHere)
|
||||
.Attach(function.latest_decl_id(), CompTimeOnlyFunctionHere)
|
||||
.Emit();
|
||||
}
|
||||
return SemIR::ConstantId::NotConstant;
|
||||
@@ -3606,10 +3606,10 @@ auto TryEvalBlockForSpecific(Context& context, SemIR::LocId loc_id,
|
||||
|
||||
Diagnostics::ContextScope diagnostic_context(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(ResolvingSpecificHere, SoftContext,
|
||||
CARBON_DIAGNOSTIC_SOFT_CONTEXT(ResolvingSpecificHere,
|
||||
"unable to monomorphize specific {0}",
|
||||
SemIR::SpecificId);
|
||||
builder.Context(loc_id, ResolvingSpecificHere, specific_id);
|
||||
builder.Attach(loc_id, ResolvingSpecificHere, specific_id);
|
||||
});
|
||||
|
||||
for (auto [i, inst_id, result_id] :
|
||||
@@ -3970,9 +3970,9 @@ static auto TryEvalCall(EvalContext& outer_eval_context, SemIR::LocId loc_id,
|
||||
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&eval_context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InCallToEvalFn, Note, "in call to {0} here",
|
||||
CARBON_DIAGNOSTIC_LABEL(InCallToEvalFn, Info, "in call to {0} here",
|
||||
SemIR::NameId);
|
||||
builder.Note(loc_id, InCallToEvalFn, function.name_id);
|
||||
builder.Attach(loc_id, InCallToEvalFn, function.name_id);
|
||||
});
|
||||
|
||||
// Execute the function decl block followed by the body.
|
||||
|
||||
@@ -610,10 +610,10 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id,
|
||||
if (complete_type_id.is_concrete()) {
|
||||
Diagnostics::ContextScope diagnostic_context(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInMonomorphization, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInMonomorphization,
|
||||
"{0} evaluates to incomplete type {1}",
|
||||
InstIdAsType, InstIdAsType);
|
||||
builder.Context(inst_id, IncompleteTypeInMonomorphization,
|
||||
builder.Attach(inst_id, IncompleteTypeInMonomorphization,
|
||||
context.insts()
|
||||
.GetAs<SemIR::RequireCompleteType>(inst_id)
|
||||
.complete_type_inst_id,
|
||||
|
||||
@@ -260,15 +260,15 @@ auto CheckFunctionReturnTypeMatches(Context& context,
|
||||
: context.emitter().Build(new_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypeDiffersNoReturn);
|
||||
if (prev_return_type_id.has_value()) {
|
||||
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(FunctionRedeclReturnTypePrevious, Info,
|
||||
"previously declared with return type {0}",
|
||||
SemIR::TypeId);
|
||||
diag.Note(prev_function.latest_decl_id(),
|
||||
diag.Attach(prev_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypePrevious, prev_return_type_id);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePreviousNoReturn, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(FunctionRedeclReturnTypePreviousNoReturn, Info,
|
||||
"previously declared with no return type");
|
||||
diag.Note(prev_function.latest_decl_id(),
|
||||
diag.Attach(prev_function.latest_decl_id(),
|
||||
FunctionRedeclReturnTypePreviousNoReturn);
|
||||
}
|
||||
diag.Emit();
|
||||
@@ -307,15 +307,16 @@ static auto CheckFunctionEvaluationModeMatches(
|
||||
"function redeclaration differs because new function is "
|
||||
"{0:=-1:not `eval`|=-2:not `musteval`|=1:`eval`|=2:`musteval`}",
|
||||
Diagnostics::IntAsSelect);
|
||||
CARBON_DIAGNOSTIC(FunctionRedeclEvaluationModePrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
FunctionRedeclEvaluationModePrevious, Info,
|
||||
"previously {0:<0:not |:}declared as "
|
||||
"{0:=-1:`eval`|=-2:`musteval`|=1:`eval`|=2:`musteval`}",
|
||||
Diagnostics::IntAsSelect);
|
||||
context.emitter()
|
||||
.Build(new_function.latest_decl_id(), FunctionRedeclEvaluationModeDiffers,
|
||||
new_eval_mode_index ? new_eval_mode_index : -prev_eval_mode_index)
|
||||
.Note(prev_function.latest_decl_id(),
|
||||
FunctionRedeclEvaluationModePrevious,
|
||||
.Attach(
|
||||
prev_function.latest_decl_id(), FunctionRedeclEvaluationModePrevious,
|
||||
prev_eval_mode_index ? prev_eval_mode_index : -new_eval_mode_index)
|
||||
.Emit();
|
||||
return false;
|
||||
@@ -356,17 +357,17 @@ auto CheckFunctionReturnPatternType(Context& context, SemIR::LocId loc_id,
|
||||
if (!RequireConcreteType(
|
||||
context, arg_type_id, SemIR::LocId(return_pattern_id),
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInFunctionReturnType,
|
||||
"function returns incomplete type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, IncompleteTypeInFunctionReturnType,
|
||||
builder.Attach(loc_id, IncompleteTypeInFunctionReturnType,
|
||||
arg_type_id);
|
||||
},
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(AbstractTypeInFunctionReturnType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInFunctionReturnType,
|
||||
"function returns abstract type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, AbstractTypeInFunctionReturnType,
|
||||
builder.Attach(loc_id, AbstractTypeInFunctionReturnType,
|
||||
arg_type_id);
|
||||
})) {
|
||||
return SemIR::ErrorInst::TypeId;
|
||||
@@ -419,11 +420,11 @@ auto CheckFunctionDefinitionSignature(Context& context,
|
||||
RequireCompleteType(
|
||||
context, context.insts().Get(param_ref_id).type_id(),
|
||||
SemIR::LocId(param_ref_id), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncompleteTypeInFunctionParam, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInFunctionParam,
|
||||
"parameter has incomplete type {0} in function definition",
|
||||
TypeOfInstId);
|
||||
builder.Context(param_ref_id, IncompleteTypeInFunctionParam,
|
||||
builder.Attach(param_ref_id, IncompleteTypeInFunctionParam,
|
||||
param_ref_id);
|
||||
});
|
||||
}
|
||||
@@ -684,19 +685,20 @@ static auto CheckDefaults(Context& context, SemIR::Function& function)
|
||||
if (!state->patterns_missing_defaults.empty()) {
|
||||
CARBON_DIAGNOSTIC(RequiredPatternDefaultValueMissing, Error,
|
||||
"this pattern is missing a required default value.");
|
||||
CARBON_DIAGNOSTIC(RequiredPatternDefaultValueFirstDefault, Note,
|
||||
"all patterns to the right of this first pattern with "
|
||||
"a default value must also specify a default value.");
|
||||
CARBON_DIAGNOSTIC(
|
||||
RequiredPatternDefaultValueMissingAdditional, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(RequiredPatternDefaultValueFirstDefault, Info,
|
||||
"all patterns to the right of this first pattern "
|
||||
"with a default value must also specify a "
|
||||
"default value.");
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
RequiredPatternDefaultValueMissingAdditional, Primary,
|
||||
"this pattern is also missing a required default value.");
|
||||
auto inst_ref = llvm::ArrayRef(state->patterns_missing_defaults);
|
||||
auto builder = context.emitter().Build(
|
||||
inst_ref.consume_front(), RequiredPatternDefaultValueMissing);
|
||||
for (auto inst_id : inst_ref) {
|
||||
builder.Note(inst_id, RequiredPatternDefaultValueMissingAdditional);
|
||||
builder.Attach(inst_id, RequiredPatternDefaultValueMissingAdditional);
|
||||
}
|
||||
builder.Note(state->first_pattern_with_default,
|
||||
builder.Attach(state->first_pattern_with_default,
|
||||
RequiredPatternDefaultValueFirstDefault);
|
||||
builder.Emit();
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ static auto IsValidParamForIntroducer(Context& context, SemIR::LocId loc_id,
|
||||
auto builder =
|
||||
context.emitter().Build(loc_id, GenericParamMustBeConstant);
|
||||
if (is_var) {
|
||||
CARBON_DIAGNOSTIC(VarParamIsRuntime, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(VarParamIsRuntime, Info,
|
||||
"`var` parameters are runtime");
|
||||
builder.Note(loc_id, VarParamIsRuntime);
|
||||
builder.Attach(loc_id, VarParamIsRuntime);
|
||||
}
|
||||
builder.Emit();
|
||||
return false;
|
||||
@@ -372,11 +372,11 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
|
||||
};
|
||||
|
||||
auto abstract_diagnostic_context = [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(AbstractTypeInVarPattern, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInVarPattern,
|
||||
"binding pattern has abstract type {0} in `var` "
|
||||
"pattern",
|
||||
SemIR::TypeId);
|
||||
builder.Context(type_expr.node_id, AbstractTypeInVarPattern,
|
||||
builder.Attach(type_expr.node_id, AbstractTypeInVarPattern,
|
||||
type_expr.type_component_id);
|
||||
};
|
||||
|
||||
@@ -516,11 +516,12 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
|
||||
return context.TODO(node_id, "support local form bindings");
|
||||
}
|
||||
auto incomplete_diagnostic_context = [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInBindingDecl, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInBindingDecl,
|
||||
"binding pattern has incomplete type {0} in name "
|
||||
"binding declaration",
|
||||
InstIdAsType);
|
||||
builder.Context(type_expr.node_id, IncompleteTypeInBindingDecl,
|
||||
builder.Attach(type_expr.node_id, IncompleteTypeInBindingDecl,
|
||||
type_expr.inst_id);
|
||||
};
|
||||
if (node_kind == Parse::NodeKind::VarBindingPattern) {
|
||||
|
||||
@@ -216,13 +216,13 @@ static auto DiagnoseClassSpecificDeclRepeated(Context& context,
|
||||
CARBON_DIAGNOSTIC(BaseDeclRepeated, Error,
|
||||
"multiple `base` declarations in class; multiple "
|
||||
"inheritance is not permitted");
|
||||
CARBON_DIAGNOSTIC(ClassSpecificDeclPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ClassSpecificDeclPrevious, Info,
|
||||
"previous `{0}` declaration is here", Lex::TokenKind);
|
||||
CARBON_CHECK(tok == Lex::TokenKind::Adapt || tok == Lex::TokenKind::Base);
|
||||
context.emitter()
|
||||
.Build(new_loc_id, tok == Lex::TokenKind::Adapt ? AdaptDeclRepeated
|
||||
: BaseDeclRepeated)
|
||||
.Note(prev_loc_id, ClassSpecificDeclPrevious, tok)
|
||||
.Attach(prev_loc_id, ClassSpecificDeclPrevious, tok)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -260,17 +260,17 @@ auto HandleParseNode(Context& context, Parse::AdaptDeclId node_id) -> bool {
|
||||
if (!RequireConcreteType(
|
||||
context, adapted_type_id, node_id,
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInAdaptDecl, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInAdaptDecl,
|
||||
"adapted type {0} is an incomplete type",
|
||||
InstIdAsType);
|
||||
builder.Context(node_id, IncompleteTypeInAdaptDecl,
|
||||
builder.Attach(node_id, IncompleteTypeInAdaptDecl,
|
||||
adapted_type_inst_id);
|
||||
},
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(AbstractTypeInAdaptDecl, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(AbstractTypeInAdaptDecl,
|
||||
"adapted type {0} is an abstract type",
|
||||
InstIdAsType);
|
||||
builder.Context(node_id, AbstractTypeInAdaptDecl,
|
||||
builder.Attach(node_id, AbstractTypeInAdaptDecl,
|
||||
adapted_type_inst_id);
|
||||
})) {
|
||||
adapted_type_id = SemIR::ErrorInst::TypeId;
|
||||
@@ -336,9 +336,10 @@ static auto CheckBaseType(Context& context, Parse::NodeId node_id,
|
||||
return BaseInfo::Error;
|
||||
}
|
||||
if (!RequireCompleteType(context, base_type_id, node_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInBaseDecl, Context,
|
||||
"base {0} is an incomplete type", InstIdAsType);
|
||||
builder.Context(node_id, IncompleteTypeInBaseDecl, base_type_inst_id);
|
||||
CARBON_DIAGNOSTIC_CONTEXT(IncompleteTypeInBaseDecl,
|
||||
"base {0} is an incomplete type",
|
||||
InstIdAsType);
|
||||
builder.Attach(node_id, IncompleteTypeInBaseDecl, base_type_inst_id);
|
||||
})) {
|
||||
return BaseInfo::Error;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
|
||||
if (inst.Is<SemIR::ExportDecl>()) {
|
||||
CARBON_DIAGNOSTIC(ExportRedundant, Warning,
|
||||
"`export` matches previous `export`");
|
||||
CARBON_DIAGNOSTIC(ExportPrevious, Note, "previous `export` here");
|
||||
CARBON_DIAGNOSTIC_LABEL(ExportPrevious, Info, "previous `export` here");
|
||||
context.emitter()
|
||||
.Build(node_id, ExportRedundant)
|
||||
// Use the location of the export itself, not the exported instruction.
|
||||
@@ -67,7 +67,7 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
|
||||
// InstId prevents GetAbsoluteNodeIdImpl() from seeing the `ExportDecl`
|
||||
// instruction, which prevents it from chasing through it to the entity
|
||||
// being exported. It might be nice to make this more explicit.
|
||||
.Note(context.insts().GetCanonicalLocId(inst_id), ExportPrevious)
|
||||
.Attach(context.insts().GetCanonicalLocId(inst_id), ExportPrevious)
|
||||
.Emit();
|
||||
return true;
|
||||
}
|
||||
@@ -76,11 +76,11 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
|
||||
if (!import_ref) {
|
||||
CARBON_DIAGNOSTIC(ExportNotImportedEntity, Error,
|
||||
"only imported entities are valid for `export`");
|
||||
CARBON_DIAGNOSTIC(ExportNotImportedEntitySource, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ExportNotImportedEntitySource, Info,
|
||||
"name is declared here");
|
||||
context.emitter()
|
||||
.Build(node_id, ExportNotImportedEntity)
|
||||
.Note(inst_id, ExportNotImportedEntitySource)
|
||||
.Attach(inst_id, ExportNotImportedEntitySource)
|
||||
.Emit();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ auto HandleParseNode(Context& context, Parse::ImplTypeAsId node_id) -> bool {
|
||||
// If the explicit self type is the default, suggest removing it with a
|
||||
// diagnostic, but continue as if no error occurred since the self-type
|
||||
// is semantically valid.
|
||||
CARBON_DIAGNOSTIC(ExtendImplSelfAsDefault, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ExtendImplSelfAsDefault, Info,
|
||||
"remove the explicit `Self` type here");
|
||||
diag.Note(self_node, ExtendImplSelfAsDefault);
|
||||
diag.Attach(self_node, ExtendImplSelfAsDefault);
|
||||
if (self_type.type_id != SemIR::ErrorInst::TypeId) {
|
||||
diag.Emit();
|
||||
}
|
||||
@@ -350,12 +350,12 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id,
|
||||
if (is_final && context.match_first_context()) {
|
||||
CARBON_DIAGNOSTIC(FinalImplInMatchFirst, Error,
|
||||
"`final impl` in `match_first` block");
|
||||
CARBON_DIAGNOSTIC(
|
||||
FinalImplInMatchFirstNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
FinalImplInMatchFirstNote, Info,
|
||||
"the `match_first` block can be modified as `final` instead");
|
||||
context.emitter()
|
||||
.Build(node_id, FinalImplInMatchFirst)
|
||||
.Note(context.match_first_context()->decl_id,
|
||||
.Attach(context.match_first_context()->decl_id,
|
||||
FinalImplInMatchFirstNote)
|
||||
.Emit();
|
||||
impl_had_error = true;
|
||||
@@ -383,11 +383,11 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id,
|
||||
CARBON_DIAGNOSTIC(
|
||||
ImplInTwoMatchFirst, Error,
|
||||
"impl declared in `match_first` more than once");
|
||||
CARBON_DIAGNOSTIC(ImplInTwoMatchFirstNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ImplInTwoMatchFirstNote, Info,
|
||||
"previous declaration here");
|
||||
context.emitter()
|
||||
.Build(node_id, ImplInTwoMatchFirst)
|
||||
.Note(prev_impl.decl_loc_in_match_first,
|
||||
.Attach(prev_impl.decl_loc_in_match_first,
|
||||
ImplInTwoMatchFirstNote)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ auto HandleParseNode(Context& context,
|
||||
MatchFirstInWrongScope, Error,
|
||||
"found `match_first` in invalid scope; expected namespace or class");
|
||||
auto builder = context.emitter().Build(node_id, MatchFirstInWrongScope);
|
||||
CARBON_DIAGNOSTIC(MatchFirstInWrongScopeNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(MatchFirstInWrongScopeNote, Info,
|
||||
"in enclosing scope here");
|
||||
builder.Note(enclosing_scope_inst_id, MatchFirstInWrongScopeNote);
|
||||
builder.Attach(enclosing_scope_inst_id, MatchFirstInWrongScopeNote);
|
||||
builder.Emit();
|
||||
context.node_stack().Push(node_id, SemIR::ErrorInst::InstId);
|
||||
return true;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
CARBON_DIAGNOSTIC(ModifierPrevious, Note, "`{0}` previously appeared here",
|
||||
Lex::TokenKind);
|
||||
CARBON_DIAGNOSTIC_LABEL(ModifierPrevious, Info,
|
||||
"`{0}` previously appeared here", Lex::TokenKind);
|
||||
|
||||
static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node,
|
||||
Parse::NodeId second_node) -> void {
|
||||
@@ -18,7 +18,7 @@ static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node,
|
||||
Lex::TokenKind);
|
||||
context.emitter()
|
||||
.Build(second_node, ModifierRepeated, context.token_kind(second_node))
|
||||
.Note(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.Attach(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static auto DiagnoseNotAllowedWith(Context& context, Parse::NodeId first_node,
|
||||
context.emitter()
|
||||
.Build(second_node, ModifierNotAllowedWith,
|
||||
context.token_kind(second_node), context.token_kind(first_node))
|
||||
.Note(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.Attach(first_node, ModifierPrevious, context.token_kind(first_node))
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ static auto HandleModifier(Context& context, Parse::NodeId node_id,
|
||||
context.emitter()
|
||||
.Build(node_id, ModifierMustAppearBefore, context.token_kind(node_id),
|
||||
context.token_kind(closest_later_modifier))
|
||||
.Note(closest_later_modifier, ModifierPrevious,
|
||||
.Attach(closest_later_modifier, ModifierPrevious,
|
||||
context.token_kind(closest_later_modifier))
|
||||
.Emit();
|
||||
return false;
|
||||
|
||||
@@ -209,10 +209,10 @@ auto HandleParseNode(Context& context, Parse::DesignatorExprId node_id)
|
||||
// note to the current "name `.Self` not found" message.
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
NoPeriodSelfForDesignator, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
NoPeriodSelfForDesignator, Info,
|
||||
"designator may only be used when `.Self` is in scope");
|
||||
builder.Note(SemIR::LocId::None, NoPeriodSelfForDesignator);
|
||||
builder.Attach(SemIR::LocId::None, NoPeriodSelfForDesignator);
|
||||
});
|
||||
period_self_id =
|
||||
HandleNameAsExpr(context, node_id, SemIR::NameId::PeriodSelf);
|
||||
|
||||
@@ -391,10 +391,10 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorStarId node_id)
|
||||
|
||||
// TODO: Check for any facet here, rather than only a type.
|
||||
if (not_pointer_type_id == SemIR::TypeType::TypeId) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
DerefOfType, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
DerefOfType, Info,
|
||||
"to form a pointer type, write the `*` after the pointee type");
|
||||
builder.Note(LocIdForDiagnostics::TokenOnly(node_id), DerefOfType);
|
||||
builder.Attach(LocIdForDiagnostics::TokenOnly(node_id), DerefOfType);
|
||||
}
|
||||
|
||||
builder.Emit();
|
||||
|
||||
@@ -246,11 +246,11 @@ static auto ValidateRequire(Context& context, SemIR::LocId full_require_loc_id,
|
||||
auto identified_facet_type_id = RequireIdentifiedFacetType(
|
||||
context, constraint_loc_id, self_type_id.AsConstantId(),
|
||||
constraint_type_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
RequireImplsUnidentifiedFacetType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
RequireImplsUnidentifiedFacetType,
|
||||
"facet type {0} cannot be identified in `require` declaration",
|
||||
SemIR::TypeId);
|
||||
builder.Context(constraint_loc_id, RequireImplsUnidentifiedFacetType,
|
||||
builder.Attach(constraint_loc_id, RequireImplsUnidentifiedFacetType,
|
||||
constraint_type_id);
|
||||
});
|
||||
if (!identified_facet_type_id.has_value()) {
|
||||
@@ -351,10 +351,11 @@ auto HandleParseNode(Context& context, Parse::RequireDeclId node_id) -> bool {
|
||||
context,
|
||||
context.types().GetTypeIdForTypeInstId(constraint_type_inst_id),
|
||||
constraint_node_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(RequireImplsIncompleteFacetType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
RequireImplsIncompleteFacetType,
|
||||
"`extend require` of incomplete facet type {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(constraint_node_id,
|
||||
builder.Attach(constraint_node_id,
|
||||
RequireImplsIncompleteFacetType,
|
||||
constraint_type_inst_id);
|
||||
})) {
|
||||
|
||||
@@ -91,12 +91,12 @@ static auto DiagnoseDuplicateNames(
|
||||
"duplicated field name `{1}` in "
|
||||
"{0:struct type literal|struct literal}",
|
||||
Diagnostics::BoolAsSelect, SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(StructNamePrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(StructNamePrevious, Info,
|
||||
"field with the same name here");
|
||||
context.emitter()
|
||||
.Build(result.value(), StructNameDuplicate, is_struct_type_literal,
|
||||
field.name_id)
|
||||
.Note(field_name_node, StructNamePrevious)
|
||||
.Attach(field_name_node, StructNamePrevious)
|
||||
.Emit();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -498,9 +498,9 @@ static auto DiagnoseNestedWhere(Context& context, SemIR::LocId loc_id,
|
||||
NestedWhereInsideWhere, Error,
|
||||
"found `where` expression nested on the right-hand side of `where`");
|
||||
auto builder = context.emitter().Build(loc_id, NestedWhereInsideWhere);
|
||||
CARBON_DIAGNOSTIC(NestedWhereInsideWhereOuterNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(NestedWhereInsideWhereOuterNote, Info,
|
||||
"on right-hand side of `where` here");
|
||||
builder.Note(outer_loc_id, NestedWhereInsideWhereOuterNote);
|
||||
builder.Attach(outer_loc_id, NestedWhereInsideWhereOuterNote);
|
||||
builder.Emit();
|
||||
}
|
||||
|
||||
|
||||
+19
-19
@@ -39,10 +39,11 @@ namespace Carbon::Check {
|
||||
// Adds the location of the associated function to a diagnostic.
|
||||
static auto NoteAssociatedFunction(Context& context, DiagnosticBuilder& builder,
|
||||
SemIR::FunctionId function_id) -> void {
|
||||
CARBON_DIAGNOSTIC(AssociatedFunctionHere, Note,
|
||||
"associated function {0} declared here", SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC_LABEL(AssociatedFunctionHere, Info,
|
||||
"associated function {0} declared here",
|
||||
SemIR::NameId);
|
||||
const auto& function = context.functions().Get(function_id);
|
||||
builder.Note(function.latest_decl_id(), AssociatedFunctionHere,
|
||||
builder.Attach(function.latest_decl_id(), AssociatedFunctionHere,
|
||||
function.name_id);
|
||||
}
|
||||
|
||||
@@ -192,12 +193,12 @@ static auto VerifyImplRedecl(Context& context, const SemIR::Impl& new_impl,
|
||||
CARBON_DIAGNOSTIC(ImplRedefinition, Error,
|
||||
"redefinition of `impl {0} as {1}`", InstIdAsRawType,
|
||||
InstIdAsRawType);
|
||||
CARBON_DIAGNOSTIC(ImplPreviousDefinition, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ImplPreviousDefinition, Info,
|
||||
"previous definition was here");
|
||||
context.emitter()
|
||||
.Build(new_impl.latest_decl_id(), ImplRedefinition, new_impl.self_id,
|
||||
new_impl.constraint_id)
|
||||
.Note(prev_impl.definition_id, ImplPreviousDefinition)
|
||||
.Attach(prev_impl.definition_id, ImplPreviousDefinition)
|
||||
.Emit();
|
||||
return ImplRedeclType::DiagnosedInvalidRedecl;
|
||||
}
|
||||
@@ -288,10 +289,10 @@ static auto ApplyExtendImplAs(Context& context, SemIR::LocId loc_id,
|
||||
if (!RequireCompleteType(
|
||||
context, context.types().GetTypeIdForTypeInstId(impl.constraint_id),
|
||||
SemIR::LocId(impl.constraint_id), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(ExtendImplAsIncomplete, Context,
|
||||
"`extend impl as` incomplete facet type {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(impl.latest_decl_id(), ExtendImplAsIncomplete,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
ExtendImplAsIncomplete,
|
||||
"`extend impl as` incomplete facet type {0}", InstIdAsType);
|
||||
builder.Attach(impl.latest_decl_id(), ExtendImplAsIncomplete,
|
||||
impl.constraint_id);
|
||||
})) {
|
||||
parent_scope.set_has_error();
|
||||
@@ -636,11 +637,11 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
|
||||
if (!RequireCompleteType(
|
||||
context, context.types().GetTypeIdForTypeInstId(impl.constraint_id),
|
||||
SemIR::LocId(impl.constraint_id), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
ImplAsIncompleteFacetTypeDefinition, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
ImplAsIncompleteFacetTypeDefinition,
|
||||
"definition of impl as incomplete facet type {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(SemIR::LocId(impl.latest_decl_id()),
|
||||
builder.Attach(SemIR::LocId(impl.latest_decl_id()),
|
||||
ImplAsIncompleteFacetTypeDefinition,
|
||||
impl.constraint_id);
|
||||
})) {
|
||||
@@ -695,7 +696,7 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
|
||||
"associated constant {0} not given a value in impl "
|
||||
"of interface {1}",
|
||||
SemIR::NameId, SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(AssociatedConstantHere, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(AssociatedConstantHere, Info,
|
||||
"associated constant declared here");
|
||||
context.emitter()
|
||||
.Build(impl.definition_id, ImplAssociatedConstantNeedsValue,
|
||||
@@ -703,7 +704,7 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
|
||||
.Get(decl->assoc_const_id)
|
||||
.name_id,
|
||||
interface.name_id)
|
||||
.Note(assoc_entity, AssociatedConstantHere)
|
||||
.Attach(assoc_entity, AssociatedConstantHere)
|
||||
.Emit();
|
||||
|
||||
witness_value = SemIR::ErrorInst::InstId;
|
||||
@@ -999,11 +1000,10 @@ auto CheckConstraintIsInterface(Context& context, SemIR::LocId loc_id,
|
||||
context.constant_values().Get(self_id),
|
||||
context.types().GetTypeIdForTypeInstId(full_constraint_id),
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(ImplOfUnidentifiedFacetType, Context,
|
||||
"facet type {0} cannot be identified in `impl as`",
|
||||
InstIdAsType);
|
||||
builder.Context(loc_id, ImplOfUnidentifiedFacetType,
|
||||
full_constraint_id);
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
ImplOfUnidentifiedFacetType,
|
||||
"facet type {0} cannot be identified in `impl as`", InstIdAsType);
|
||||
builder.Attach(loc_id, ImplOfUnidentifiedFacetType, full_constraint_id);
|
||||
});
|
||||
if (!identified_id.has_value()) {
|
||||
return SemIR::IdentifiedFacetTypeId::None;
|
||||
|
||||
@@ -208,9 +208,10 @@ static auto FindAndDiagnoseImplLookupCycle(
|
||||
context.types().GetTypeIdForTypeConstantId(query_self_const_id));
|
||||
for (const auto& active_entry : llvm::drop_begin(stack, i)) {
|
||||
if (active_entry.impl_loc.has_value()) {
|
||||
CARBON_DIAGNOSTIC(ImplLookupCycleNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
ImplLookupCycleNote, Info,
|
||||
"determining if this impl clause matches", );
|
||||
builder.Note(active_entry.impl_loc, ImplLookupCycleNote);
|
||||
builder.Attach(active_entry.impl_loc, ImplLookupCycleNote);
|
||||
}
|
||||
}
|
||||
builder.Emit();
|
||||
@@ -866,10 +867,10 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id,
|
||||
context, loc_id, query_self_const_id,
|
||||
context.types().GetTypeIdForTypeConstantId(query_facet_type_const_id),
|
||||
[&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(ImplLookupInUnidentifiedFacetType, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(ImplLookupInUnidentifiedFacetType,
|
||||
"facet type {0} can not be identified",
|
||||
SemIR::TypeId);
|
||||
builder.Context(loc_id, ImplLookupInUnidentifiedFacetType,
|
||||
builder.Attach(loc_id, ImplLookupInUnidentifiedFacetType,
|
||||
context.types().GetTypeIdForTypeConstantId(
|
||||
query_facet_type_const_id));
|
||||
},
|
||||
|
||||
@@ -257,9 +257,9 @@ static auto DiagnoseNonFinalImplsWithSameTypeStructureOutsideMatchFirst(
|
||||
"structure as another non-final `impl`");
|
||||
auto builder = context.emitter().Build(impl_b.latest_decl_id,
|
||||
ImplNonFinalSameTypeStructure);
|
||||
CARBON_DIAGNOSTIC(ImplNonFinalSameTypeStructureNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ImplNonFinalSameTypeStructureNote, Info,
|
||||
"other `impl` here");
|
||||
builder.Note(impl_a.latest_decl_id, ImplNonFinalSameTypeStructureNote);
|
||||
builder.Attach(impl_a.latest_decl_id, ImplNonFinalSameTypeStructureNote);
|
||||
builder.Emit();
|
||||
return true;
|
||||
}
|
||||
@@ -285,10 +285,10 @@ static auto DiagnoseUnmatchableNonFinalImplWithFinalImpl(Context& context,
|
||||
"`impl` will never be used");
|
||||
auto builder = context.emitter().Build(query_impl.latest_decl_id,
|
||||
ImplFinalOverlapsNonFinal);
|
||||
CARBON_DIAGNOSTIC(
|
||||
ImplFinalOverlapsNonFinalNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
ImplFinalOverlapsNonFinalNote, Info,
|
||||
"`final impl` declared here would always be used instead");
|
||||
builder.Note(final_impl.latest_decl_id, ImplFinalOverlapsNonFinalNote);
|
||||
builder.Attach(final_impl.latest_decl_id, ImplFinalOverlapsNonFinalNote);
|
||||
builder.Emit();
|
||||
return true;
|
||||
}
|
||||
@@ -316,17 +316,17 @@ static auto DiagnoseFinalImplsOverlapInDifferentFiles(Context& context,
|
||||
CARBON_DIAGNOSTIC(
|
||||
FinalImplOverlapsDifferentFile, Error,
|
||||
"`final impl` overlaps with `final impl` from another file");
|
||||
CARBON_DIAGNOSTIC(FinalImplOverlapsDifferentFileNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(FinalImplOverlapsDifferentFileNote, Info,
|
||||
"imported `final impl` here");
|
||||
if (impl_a.is_local) {
|
||||
auto builder = context.emitter().Build(impl_a.latest_decl_id,
|
||||
FinalImplOverlapsDifferentFile);
|
||||
builder.Note(impl_b.latest_decl_id, FinalImplOverlapsDifferentFileNote);
|
||||
builder.Attach(impl_b.latest_decl_id, FinalImplOverlapsDifferentFileNote);
|
||||
builder.Emit();
|
||||
} else {
|
||||
auto builder = context.emitter().Build(impl_b.latest_decl_id,
|
||||
FinalImplOverlapsDifferentFile);
|
||||
builder.Note(impl_a.latest_decl_id, FinalImplOverlapsDifferentFileNote);
|
||||
builder.Attach(impl_a.latest_decl_id, FinalImplOverlapsDifferentFileNote);
|
||||
builder.Emit();
|
||||
}
|
||||
return true;
|
||||
@@ -351,9 +351,9 @@ static auto DiagnoseFinalImplsOverlapOutsideMatchFirst(Context& context,
|
||||
"outside a `match_first` block");
|
||||
auto builder = context.emitter().Build(impl_b.latest_decl_id,
|
||||
FinalImplOverlapsSameFile);
|
||||
CARBON_DIAGNOSTIC(FinalImplOverlapsSameFileNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(FinalImplOverlapsSameFileNote, Info,
|
||||
"other `final impl` here");
|
||||
builder.Note(impl_a.latest_decl_id, FinalImplOverlapsSameFileNote);
|
||||
builder.Attach(impl_a.latest_decl_id, FinalImplOverlapsSameFileNote);
|
||||
builder.Emit();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -641,9 +641,9 @@ auto ImportNameFromOtherPackage(
|
||||
// Annotate diagnostics as occurring during this name lookup.
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context.emitter(), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(InNameLookup, Note, "in name lookup for `{0}`",
|
||||
CARBON_DIAGNOSTIC_LABEL(InNameLookup, Info, "in name lookup for `{0}`",
|
||||
SemIR::NameId);
|
||||
builder.Note(loc_id, InNameLookup, name_id);
|
||||
builder.Attach(loc_id, InNameLookup, name_id);
|
||||
});
|
||||
|
||||
// Although we track the result here and look in each IR, we pretty much use
|
||||
|
||||
@@ -173,9 +173,9 @@ auto MakeStringLiteral(Context& context, Parse::StringLiteralId node_id,
|
||||
auto str_type = MakeStringType(context, SemIR::LocId(node_id).AsDesugared());
|
||||
if (!RequireCompleteType(
|
||||
context, str_type.type_id, node_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(StringLiteralTypeIncomplete, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(StringLiteralTypeIncomplete,
|
||||
"type {0} is incomplete", InstIdAsType);
|
||||
builder.Context(node_id, StringLiteralTypeIncomplete,
|
||||
builder.Attach(node_id, StringLiteralTypeIncomplete,
|
||||
str_type.inst_id);
|
||||
})) {
|
||||
return SemIR::ErrorInst::InstId;
|
||||
|
||||
@@ -538,11 +538,11 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id,
|
||||
// scopes directly on the facet type.
|
||||
if (!RequireCompleteType(
|
||||
context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncompleteTypeInMemberAccessOfFacet, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInMemberAccessOfFacet,
|
||||
"member access into facet of incomplete type {0}",
|
||||
SemIR::TypeId);
|
||||
builder.Context(base_id, IncompleteTypeInMemberAccessOfFacet,
|
||||
builder.Attach(base_id, IncompleteTypeInMemberAccessOfFacet,
|
||||
base_type_id);
|
||||
})) {
|
||||
// If the scope is invalid in AppendLookupScopesForConstant we still
|
||||
@@ -582,11 +582,11 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id,
|
||||
// done to give a better error than "invalid use of" an incomplete type?
|
||||
if (!RequireCompleteType(
|
||||
context, base_type_id, SemIR::LocId(base_id), [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
IncompleteTypeInMemberAccess, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
IncompleteTypeInMemberAccess,
|
||||
"member access into object of incomplete type {0}",
|
||||
TypeOfInstId);
|
||||
builder.Context(base_id, IncompleteTypeInMemberAccess, base_id);
|
||||
builder.Attach(base_id, IncompleteTypeInMemberAccess, base_id);
|
||||
})) {
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
|
||||
+22
-21
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
CARBON_DIAGNOSTIC(RedeclPrevDecl, Note, "previously declared here");
|
||||
CARBON_DIAGNOSTIC_LABEL(RedeclPrevDecl, Info, "previously declared here");
|
||||
|
||||
// Diagnoses a redeclaration which is redundant.
|
||||
static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind,
|
||||
@@ -25,7 +25,7 @@ static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind,
|
||||
SemIR::NameId);
|
||||
context.emitter()
|
||||
.Build(new_loc_id, RedeclRedundant, decl_kind, name_id)
|
||||
.Note(prev_loc_id, RedeclPrevDecl)
|
||||
.Attach(prev_loc_id, RedeclPrevDecl)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ static auto DiagnoseRedef(Context& context, Lex::TokenKind decl_kind,
|
||||
SemIR::LocId prev_loc_id) -> void {
|
||||
CARBON_DIAGNOSTIC(RedeclRedef, Error, "redefinition of `{0} {1}`",
|
||||
Lex::TokenKind, SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(RedeclPrevDef, Note, "previously defined here");
|
||||
CARBON_DIAGNOSTIC_LABEL(RedeclPrevDef, Info, "previously defined here");
|
||||
context.emitter()
|
||||
.Build(new_loc_id, RedeclRedef, decl_kind, name_id)
|
||||
.Note(prev_loc_id, RedeclPrevDef)
|
||||
.Attach(prev_loc_id, RedeclPrevDef)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ static auto DiagnoseExternMismatch(Context& context, Lex::TokenKind decl_kind,
|
||||
Lex::TokenKind, SemIR::NameId);
|
||||
context.emitter()
|
||||
.Build(new_loc_id, RedeclExternMismatch, decl_kind, name_id)
|
||||
.Note(prev_loc_id, RedeclPrevDecl)
|
||||
.Attach(prev_loc_id, RedeclPrevDecl)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ static auto DiagnoseExternLibraryInImporter(Context& context,
|
||||
Lex::TokenKind, SemIR::NameId);
|
||||
context.emitter()
|
||||
.Build(new_loc_id, ExternLibraryInImporter, decl_kind, name_id)
|
||||
.Note(prev_loc_id, RedeclPrevDecl)
|
||||
.Attach(prev_loc_id, RedeclPrevDecl)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -79,11 +79,11 @@ static auto DiagnoseExternLibraryIncorrect(Context& context,
|
||||
ExternLibraryIncorrect, Error,
|
||||
"declaration in {0} doesn't match `extern library` declaration",
|
||||
SemIR::LibraryNameId);
|
||||
CARBON_DIAGNOSTIC(ExternLibraryExpected, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ExternLibraryExpected, Info,
|
||||
"previously declared with `extern library` here");
|
||||
context.emitter()
|
||||
.Build(new_loc_id, ExternLibraryIncorrect, context.sem_ir().library_id())
|
||||
.Note(prev_loc_id, ExternLibraryExpected)
|
||||
.Attach(prev_loc_id, ExternLibraryExpected)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -213,8 +213,8 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param,
|
||||
SemIR::InstId orig_prev_param_pattern_id,
|
||||
SemIR::SpecificId prev_specific_id, bool diagnose,
|
||||
bool check_syntax) -> bool {
|
||||
CARBON_DIAGNOSTIC(
|
||||
RedeclParamPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
RedeclParamPrevious, Info,
|
||||
"previous declaration's corresponding {0:implicit |}parameter here",
|
||||
Diagnostics::BoolAsSelect);
|
||||
auto emit_general_diagnostic = [&]() {
|
||||
@@ -227,7 +227,7 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param,
|
||||
context.emitter()
|
||||
.Build(orig_new_param_pattern_id, RedeclParamDiffers, is_implicit_param,
|
||||
param_index + 1)
|
||||
.Note(orig_prev_param_pattern_id, RedeclParamPrevious,
|
||||
.Attach(orig_prev_param_pattern_id, RedeclParamPrevious,
|
||||
is_implicit_param)
|
||||
.Emit();
|
||||
};
|
||||
@@ -279,7 +279,7 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param,
|
||||
.Build(orig_new_param_pattern_id, RedeclParamDiffersType,
|
||||
is_implicit_param, param_index + 1, prev_param_type_id,
|
||||
new_param_pattern.type_id())
|
||||
.Note(orig_prev_param_pattern_id, RedeclParamPrevious,
|
||||
.Attach(orig_prev_param_pattern_id, RedeclParamPrevious,
|
||||
is_implicit_param)
|
||||
.Emit();
|
||||
}
|
||||
@@ -390,14 +390,15 @@ static auto CheckRedeclParams(Context& context, SemIR::LocId new_decl_loc_id,
|
||||
"redeclaration differs because of "
|
||||
"{1:|missing }{0:implicit |}parameter list",
|
||||
Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect);
|
||||
CARBON_DIAGNOSTIC(RedeclParamListPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(RedeclParamListPrevious, Info,
|
||||
"previously declared "
|
||||
"{1:with|without} {0:implicit |}parameter list",
|
||||
Diagnostics::BoolAsSelect, Diagnostics::BoolAsSelect);
|
||||
Diagnostics::BoolAsSelect,
|
||||
Diagnostics::BoolAsSelect);
|
||||
context.emitter()
|
||||
.Build(new_decl_loc_id, RedeclParamListDiffers, is_implicit_param,
|
||||
new_param_patterns_id.has_value())
|
||||
.Note(prev_decl_loc_id, RedeclParamListPrevious, is_implicit_param,
|
||||
.Attach(prev_decl_loc_id, RedeclParamListPrevious, is_implicit_param,
|
||||
prev_param_patterns_id.has_value())
|
||||
.Emit();
|
||||
return false;
|
||||
@@ -417,14 +418,14 @@ static auto CheckRedeclParams(Context& context, SemIR::LocId new_decl_loc_id,
|
||||
RedeclParamCountDiffers, Error,
|
||||
"redeclaration differs because of {0:implicit |}parameter count of {1}",
|
||||
Diagnostics::BoolAsSelect, int32_t);
|
||||
CARBON_DIAGNOSTIC(
|
||||
RedeclParamCountPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(
|
||||
RedeclParamCountPrevious, Info,
|
||||
"previously declared with {0:implicit |}parameter count of {1}",
|
||||
Diagnostics::BoolAsSelect, int32_t);
|
||||
context.emitter()
|
||||
.Build(new_decl_loc_id, RedeclParamCountDiffers, is_implicit_param,
|
||||
new_param_pattern_ids.size())
|
||||
.Note(prev_decl_loc_id, RedeclParamCountPrevious, is_implicit_param,
|
||||
.Attach(prev_decl_loc_id, RedeclParamCountPrevious, is_implicit_param,
|
||||
prev_param_pattern_ids.size())
|
||||
.Emit();
|
||||
return false;
|
||||
@@ -536,11 +537,11 @@ static auto CheckRedeclParamSyntax(Context& context,
|
||||
}
|
||||
CARBON_DIAGNOSTIC(RedeclParamSyntaxDiffers, Error,
|
||||
"redeclaration syntax differs here");
|
||||
CARBON_DIAGNOSTIC(RedeclParamSyntaxPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(RedeclParamSyntaxPrevious, Info,
|
||||
"comparing with previous declaration here");
|
||||
context.emitter()
|
||||
.Build(new_node_id, RedeclParamSyntaxDiffers)
|
||||
.Note(prev_node_id, RedeclParamSyntaxPrevious)
|
||||
.Attach(prev_node_id, RedeclParamSyntaxPrevious)
|
||||
.Emit();
|
||||
return false;
|
||||
}
|
||||
@@ -839,7 +840,7 @@ auto TryMergeRedecl(Context& context,
|
||||
context.emitter()
|
||||
.Build(entity_info.new_entity.latest_decl_id(),
|
||||
DeducedReturnTypeRedecl)
|
||||
.Note(prev_entity.latest_decl_id(), RedeclPrevDecl)
|
||||
.Attach(prev_entity.latest_decl_id(), RedeclPrevDecl)
|
||||
.Emit();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,9 @@ static auto DiagnoseNotAllowed(
|
||||
auto diag = StartDiagnoseNotAllowed(context, diagnostic_base, modifier_node,
|
||||
decl_kind);
|
||||
if (context_loc_id.has_value()) {
|
||||
CARBON_DIAGNOSTIC(ModifierNotInContext, Note, "containing definition here");
|
||||
diag.Note(context_loc_id, ModifierNotInContext);
|
||||
CARBON_DIAGNOSTIC_LABEL(ModifierNotInContext, Info,
|
||||
"containing definition here");
|
||||
diag.Attach(context_loc_id, ModifierNotInContext);
|
||||
}
|
||||
diag.Emit();
|
||||
}
|
||||
|
||||
@@ -266,11 +266,11 @@ static auto DiagnoseInvalidQualifiedNameAccess(
|
||||
ClassInvalidMemberAccess, Error,
|
||||
"cannot access {0:private|protected} member `{1}` of type {2}",
|
||||
Diagnostics::BoolAsSelect, SemIR::NameId, SemIR::TypeId);
|
||||
CARBON_DIAGNOSTIC(ClassMemberDeclaration, Note, "declared here");
|
||||
CARBON_DIAGNOSTIC_LABEL(ClassMemberDeclaration, Info, "declared here");
|
||||
context.emitter()
|
||||
.Build(loc_id, ClassInvalidMemberAccess,
|
||||
access_kind == SemIR::AccessKind::Private, name_id, scope_type_id)
|
||||
.Note(member_loc_id, ClassMemberDeclaration)
|
||||
.Attach(member_loc_id, ClassMemberDeclaration)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -368,10 +368,10 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id,
|
||||
RequireCompleteType(
|
||||
context, context.types().GetTypeIdForTypeConstantId(lookup_const_id),
|
||||
loc_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(QualifiedExprInIncompleteClassScope, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(QualifiedExprInIncompleteClassScope,
|
||||
"member access into incomplete class {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(loc_id, QualifiedExprInIncompleteClassScope,
|
||||
builder.Attach(loc_id, QualifiedExprInIncompleteClassScope,
|
||||
lookup_inst_id);
|
||||
});
|
||||
}
|
||||
@@ -396,11 +396,11 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id,
|
||||
context,
|
||||
context.types().GetTypeIdForTypeConstantId(lookup_const_id),
|
||||
loc_id, [&](auto& builder) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
QualifiedExprInIncompleteFacetTypeScope, Context,
|
||||
CARBON_DIAGNOSTIC_CONTEXT(
|
||||
QualifiedExprInIncompleteFacetTypeScope,
|
||||
"member access into incomplete facet type {0}",
|
||||
InstIdAsType);
|
||||
builder.Context(loc_id, QualifiedExprInIncompleteFacetTypeScope,
|
||||
builder.Attach(loc_id, QualifiedExprInIncompleteFacetTypeScope,
|
||||
lookup_inst_id);
|
||||
})) {
|
||||
// Lookup into this scope should fail without producing an error since
|
||||
@@ -710,10 +710,11 @@ auto DiagnoseDuplicateName(Context& context, SemIR::NameId name_id,
|
||||
CARBON_DIAGNOSTIC(NameDeclDuplicate, Error,
|
||||
"duplicate name `{0}` being declared in the same scope",
|
||||
SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(NameDeclPrevious, Note, "name is previously declared here");
|
||||
CARBON_DIAGNOSTIC_LABEL(NameDeclPrevious, Info,
|
||||
"name is previously declared here");
|
||||
context.emitter()
|
||||
.Build(dup_def, NameDeclDuplicate, name_id)
|
||||
.Note(prev_def, NameDeclPrevious)
|
||||
.Attach(prev_def, NameDeclPrevious)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
@@ -724,10 +725,10 @@ auto DiagnosePoisonedName(Context& context, SemIR::NameId name_id,
|
||||
"Trying to diagnose poisoned name with no poisoning location");
|
||||
CARBON_DIAGNOSTIC(NameUseBeforeDecl, Error,
|
||||
"name `{0}` used before it was declared", SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(NameUseBeforeDeclNote, Note, "declared here");
|
||||
CARBON_DIAGNOSTIC_LABEL(NameUseBeforeDeclNote, Info, "declared here");
|
||||
context.emitter()
|
||||
.Build(poisoning_loc_id, NameUseBeforeDecl, name_id)
|
||||
.Note(decl_name_loc_id, NameUseBeforeDeclNote)
|
||||
.Attach(decl_name_loc_id, NameUseBeforeDeclNote)
|
||||
.Emit();
|
||||
}
|
||||
|
||||
|
||||
@@ -278,9 +278,9 @@ auto MatchContext::Match(State state, WorkItem entry) -> void {
|
||||
Diagnostics::AnnotationScope annotate_diagnostics(
|
||||
&context_.emitter(), [&](auto& builder) {
|
||||
if (std::holds_alternative<CallerState*>(state)) {
|
||||
CARBON_DIAGNOSTIC(InCallToFunctionParam, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(InCallToFunctionParam, Info,
|
||||
"initializing function parameter");
|
||||
builder.Note(entry.pattern_id, InCallToFunctionParam);
|
||||
builder.Attach(entry.pattern_id, InCallToFunctionParam);
|
||||
}
|
||||
});
|
||||
CARBON_CHECK(stack_.empty());
|
||||
|
||||
+18
-15
@@ -58,18 +58,18 @@ static auto GetCurrentReturnedVar(Context& context) -> SemIR::InstId {
|
||||
// Produces a note that the given function has no explicit return type.
|
||||
static auto NoteNoReturnTypeProvided(DiagnosticBuilder& diag,
|
||||
const SemIR::Function& function) {
|
||||
CARBON_DIAGNOSTIC(ReturnTypeOmittedNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnTypeOmittedNote, Info,
|
||||
"there was no return type provided");
|
||||
diag.Note(function.latest_decl_id(), ReturnTypeOmittedNote);
|
||||
diag.Attach(function.latest_decl_id(), ReturnTypeOmittedNote);
|
||||
}
|
||||
|
||||
// Produces a note describing the return type of the given function, which
|
||||
// must be a function whose definition is currently being checked.
|
||||
static auto NoteReturnType(DiagnosticBuilder& diag,
|
||||
const SemIR::Function& function) {
|
||||
CARBON_DIAGNOSTIC(ReturnTypeHereNote, Note, "return type of function is {0}",
|
||||
InstIdAsType);
|
||||
diag.Note(function.return_type_inst_id, ReturnTypeHereNote,
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnTypeHereNote, Info,
|
||||
"return type of function is {0}", InstIdAsType);
|
||||
diag.Attach(function.return_type_inst_id, ReturnTypeHereNote,
|
||||
function.return_type_inst_id);
|
||||
}
|
||||
|
||||
@@ -77,16 +77,17 @@ static auto NoteReturnType(DiagnosticBuilder& diag,
|
||||
// function whose return type has not been deduced yet.
|
||||
static auto NoteReturnTypeIsDeduced(DiagnosticBuilder& diag,
|
||||
const SemIR::Function& function) {
|
||||
CARBON_DIAGNOSTIC(ReturnTypeIsDeducedNote, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnTypeIsDeducedNote, Info,
|
||||
"return type of function is deduced");
|
||||
diag.Note(function.latest_decl_id(), ReturnTypeIsDeducedNote);
|
||||
diag.Attach(function.latest_decl_id(), ReturnTypeIsDeducedNote);
|
||||
}
|
||||
|
||||
// Produces a note pointing at the currently in scope `returned var`.
|
||||
static auto NoteReturnedVar(DiagnosticBuilder& diag,
|
||||
SemIR::InstId returned_var_id) {
|
||||
CARBON_DIAGNOSTIC(ReturnedVarHere, Note, "`returned var` was declared here");
|
||||
diag.Note(returned_var_id, ReturnedVarHere);
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnedVarHere, Info,
|
||||
"`returned var` was declared here");
|
||||
diag.Attach(returned_var_id, ReturnedVarHere);
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -219,9 +220,9 @@ static auto CompletePendingReturns(Context& context,
|
||||
&context.emitter(), [&](DiagnosticBuilder& builder) {
|
||||
// TODO: Track the instruction the return type was deduced for and use
|
||||
// TypeOfInstId to preserve sugar.
|
||||
CARBON_DIAGNOSTIC(ReturnTypeDeducedAs, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnTypeDeducedAs, Info,
|
||||
"return type deduced as {0}", InstIdAsType);
|
||||
builder.Note(function.return_type_inst_id, ReturnTypeDeducedAs,
|
||||
builder.Attach(function.return_type_inst_id, ReturnTypeDeducedAs,
|
||||
function.return_type_inst_id);
|
||||
});
|
||||
|
||||
@@ -301,8 +302,9 @@ auto RegisterReturnedVar(Context& context, Parse::NodeId returned_node,
|
||||
"`returned var` declaration in function with "
|
||||
"non-initializing return form");
|
||||
auto diag = context.emitter().Build(returned_node, ReturnedVarNotInit);
|
||||
CARBON_DIAGNOSTIC(ReturnFormHereNote, Note, "return form declared here");
|
||||
diag.Note(function.return_form_inst_id, ReturnFormHereNote);
|
||||
CARBON_DIAGNOSTIC_LABEL(ReturnFormHereNote, Info,
|
||||
"return form declared here");
|
||||
diag.Attach(function.return_form_inst_id, ReturnFormHereNote);
|
||||
diag.Emit();
|
||||
}
|
||||
|
||||
@@ -446,12 +448,13 @@ auto DeduceReturnTypeAtEndOfBody(Context& context,
|
||||
DeducedReturnTypeMismatch, Error,
|
||||
"deduced return type {0} does not match return type deduced earlier",
|
||||
TypeOfInstId);
|
||||
CARBON_DIAGNOSTIC(DeducedReturnTypeMismatchPrevious, Note,
|
||||
CARBON_DIAGNOSTIC_LABEL(DeducedReturnTypeMismatchPrevious, Info,
|
||||
"return type previously deduced as {0} here",
|
||||
TypeOfInstId);
|
||||
context.emitter()
|
||||
.Build(pending.expr_id, DeducedReturnTypeMismatch, pending.expr_id)
|
||||
.Note(first_expr_id, DeducedReturnTypeMismatchPrevious, first_expr_id)
|
||||
.Attach(first_expr_id, DeducedReturnTypeMismatchPrevious,
|
||||
first_expr_id)
|
||||
.Emit();
|
||||
return_type_id = SemIR::ErrorInst::TypeId;
|
||||
break;
|
||||
|
||||
+17
-51
@@ -51,13 +51,9 @@ let v: a = {} as A({});
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+8]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: alias a = true or false;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11-17: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: alias a = true or false;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+2]]:11-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
alias a = true or false;
|
||||
|
||||
@@ -68,22 +64,14 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
alias a = C;
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: var a: C = {};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: alias a = C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:7: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR:
|
||||
var a: C = {};
|
||||
|
||||
var b: C = {};
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: alias b = C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: var b: C = {};
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:5-8: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR:
|
||||
alias b = C;
|
||||
|
||||
@@ -94,9 +82,7 @@ library "[[@TEST_NAME]]";
|
||||
var a: () = ();
|
||||
var b: ()* = &a;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:11: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: alias c = *b;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+2]]:11-12: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR:
|
||||
alias c = *b;
|
||||
|
||||
@@ -104,9 +90,7 @@ alias c = *b;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams]
|
||||
// CHECK:STDERR: alias A(T: type) = T*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams]
|
||||
// CHECK:STDERR:
|
||||
alias A(T: type) = T*;
|
||||
|
||||
@@ -116,42 +100,24 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class {}
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:10: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+22]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+10]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:15: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:15-21: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:23: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:23-27: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR:
|
||||
abstract base default final alias A = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: impl alias B = Class;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR:
|
||||
impl alias B = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: extern alias C = Class;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR:
|
||||
extern alias C = Class;
|
||||
|
||||
|
||||
+2
-4
@@ -56,9 +56,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "export";
|
||||
|
||||
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+4]]:8: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: var c: C = {};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+2]]:8: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR:
|
||||
var c: C = {};
|
||||
|
||||
@@ -277,7 +275,7 @@ var d: D* = &c;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%c.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+4
-8
@@ -38,9 +38,7 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "def";
|
||||
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: var inst: A = {};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:11: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR:
|
||||
var inst: A = {};
|
||||
|
||||
@@ -50,9 +48,7 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "def";
|
||||
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:11: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: var inst: Test.A = {};
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:11-16: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR:
|
||||
var inst: Test.A = {};
|
||||
|
||||
@@ -167,7 +163,7 @@ var inst: Test.A = {};
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%inst.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
@@ -207,7 +203,7 @@ var inst: Test.A = {};
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: assign file.%inst.var, <error>
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+2
-6
@@ -34,14 +34,10 @@ library "[[@TEST_NAME]]";
|
||||
namespace NS;
|
||||
|
||||
fn F() -> {} {
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:9: error: name `NS` not found [NameNotFound]
|
||||
// CHECK:STDERR: alias NS.a = {};
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:9-10: error: name `NS` not found [NameNotFound]
|
||||
// CHECK:STDERR:
|
||||
alias NS.a = {};
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:10: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: return NS.a;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:10-13: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR:
|
||||
return NS.a;
|
||||
}
|
||||
|
||||
+10
-30
@@ -19,37 +19,21 @@ alias A = C;
|
||||
|
||||
// The diagnostics below should refer to `A`, not `C`.
|
||||
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:15: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fn F() -> A { return; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `A` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: fn F() -> A { return; }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:15-21: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11: note: return type of function is `A` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR:
|
||||
fn F() -> A { return; }
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:16: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fn G() -> A* { return; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: fn G() -> A* { return; }
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:16-22: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-12: note: return type of function is `A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR:
|
||||
fn G() -> A* { return; }
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:22: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fn H() -> const A* { return; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `const A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: fn H() -> const A* { return; }
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:22-28: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-18: note: return type of function is `const A*` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR:
|
||||
fn H() -> const A* { return; }
|
||||
// TODO: Preserve type sugar in generic arguments, such as for `Core.Array`.
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+7]]:26: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fn I() -> array(A, 42) { return; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+4]]:11: note: return type of function is `array(C, 42)` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR: fn I() -> array(A, 42) { return; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:26-32: error: missing return value [ReturnStatementMissingExpr]
|
||||
// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-22: note: return type of function is `array(C, 42)` [ReturnTypeHereNote]
|
||||
// CHECK:STDERR:
|
||||
fn I() -> array(A, 42) { return; }
|
||||
|
||||
@@ -67,16 +51,12 @@ fn MakePtr() -> A*;
|
||||
|
||||
fn F() {
|
||||
// The type of a call is the declared return type of the callee.
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+4]]:3: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: MakePtr().missing;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-19: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR:
|
||||
MakePtr().missing;
|
||||
|
||||
// The type of a dereference is the pointee type of the pointer's type.
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+4]]:3: error: value of type `A` is not callable [CallToNonCallable]
|
||||
// CHECK:STDERR: (*MakePtr())();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-16: error: value of type `A` is not callable [CallToNonCallable]
|
||||
// CHECK:STDERR:
|
||||
(*MakePtr())();
|
||||
}
|
||||
+1
-3
@@ -34,9 +34,7 @@ library "[[@TEST_NAME]]";
|
||||
fn F() -> () {
|
||||
var a: () = ();
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_local.carbon:[[@LINE+4]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR: alias b = a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_local.carbon:[[@LINE+2]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue]
|
||||
// CHECK:STDERR:
|
||||
alias b = a;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
+7
-21
@@ -81,22 +81,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Incomplete;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+17]]:8: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var a: array(Incomplete, 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: min_prelude/parts/array.carbon:12:3: note: `<builtin array(T, N)>` evaluates to incomplete type `<builtin array(Incomplete, 1)>` [IncompleteTypeInMonomorphization]
|
||||
// CHECK:STDERR: adapt MakeArray(T, N);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: min_prelude/parts/array.carbon:12:3-24: note: `<builtin array(T, N)>` evaluates to incomplete type `<builtin array(Incomplete, 1)>` [IncompleteTypeInMonomorphization]
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var a: array(Incomplete, 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-15]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-7]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR:
|
||||
var a: array(Incomplete, 1);
|
||||
|
||||
@@ -106,12 +96,8 @@ var p: Incomplete* = &a[0];
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+7]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: var a: array(1, 1);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var a: array(1, 1);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var a: array(1, 1);
|
||||
|
||||
|
||||
+4
-12
@@ -36,9 +36,7 @@ let b: array(i32, 3)* = &a;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_negative.carbon:[[@LINE+4]]:19: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: var a: array(i32, -1);
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_negative.carbon:[[@LINE+2]]:19-20: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR:
|
||||
var a: array(i32, -1);
|
||||
|
||||
@@ -46,9 +44,7 @@ var a: array(i32, -1);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:19: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: var a: array(i32, 39999999999999999993);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:19-38: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR:
|
||||
var a: array(i32, 39999999999999999993);
|
||||
|
||||
@@ -56,12 +52,8 @@ var a: array(i32, 39999999999999999993);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+7]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: var b: array(1, 39999999999999999993);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+4]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var b: array(1, 39999999999999999993);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var b: array(1, 39999999999999999993);
|
||||
|
||||
|
||||
+9
-27
@@ -16,12 +16,8 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class C {}
|
||||
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: var a: array(C, 3) = ({}, (), true);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+4]]:22: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var a: array(C, 3) = ({}, (), true);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+3]]:22-35: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+2]]:22-35: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var a: array(C, 3) = ({}, (), true);
|
||||
|
||||
@@ -33,22 +29,14 @@ class C {}
|
||||
class D {}
|
||||
|
||||
var a: (D, C, D);
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+7]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: var b: array(C, 3) = a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var b: array(C, 3) = a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var b: array(C, 3) = a;
|
||||
|
||||
var c: (C, D, D);
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+7]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: var d: array(C, 3) = c;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+4]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var d: array(C, 3) = c;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var d: array(C, 3) = c;
|
||||
|
||||
@@ -58,9 +46,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class C {}
|
||||
|
||||
// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+4]]:22: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: var a: array(C, 3) = ({}, {});
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+2]]:22-29: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR:
|
||||
var a: array(C, 3) = ({}, {});
|
||||
|
||||
@@ -71,16 +57,12 @@ library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
var a: (C, C);
|
||||
// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+4]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch]
|
||||
// CHECK:STDERR: var b: array(C, 3) = a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+2]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch]
|
||||
// CHECK:STDERR:
|
||||
var b: array(C, 3) = a;
|
||||
|
||||
// --- fail_arg_too_long.carbon
|
||||
|
||||
// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+4]]:23: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: var a: array((), 1) = ((), (), ());
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+2]]:23-34: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR:
|
||||
var a: array((), 1) = ((), (), ());
|
||||
+1
-3
@@ -39,9 +39,7 @@ fn F(a: array({}, 3)) -> {} {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F(a: array({}, 3)) -> {} {
|
||||
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+4]]:12: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds]
|
||||
// CHECK:STDERR: return a[{.index = 3}.index];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+2]]:12-29: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds]
|
||||
// CHECK:STDERR:
|
||||
return a[{.index = 3}.index];
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ fn H() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F(generic N: i32) {
|
||||
// CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+4]]:35: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
|
||||
// CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+2]]:35-43: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
|
||||
// CHECK:STDERR:
|
||||
var unused arr: array(i32, N) = (1, 2, 3);
|
||||
}
|
||||
|
||||
+5
-15
@@ -133,15 +133,9 @@ fn F(a: A) {
|
||||
// a copy to perform initialization. It's not clear whether that is the right
|
||||
// behavior.
|
||||
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:26: note: in copy of `A` [InCopy]
|
||||
// CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:3-22: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+3]]:3-22: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+2]]:26-54: note: in copy of `A` [InCopy]
|
||||
// CHECK:STDERR:
|
||||
var unused a_init: A = (a as ({}, Noncopyable)) as A;
|
||||
}
|
||||
@@ -161,12 +155,8 @@ class B {
|
||||
// We do not try to implicitly convert from the first operand of `as` to the
|
||||
// adapted type of the second operand.
|
||||
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+7]]:12: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: var b: B = {.x = ()} as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+4]]:12: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var b: B = {.x = ()} as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12-25: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+2]]:12-25: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var b: B = {.x = ()} as B;
|
||||
|
||||
|
||||
+4
-12
@@ -106,12 +106,8 @@ let n: Y = ({.x = ()} as X) as Y;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:13: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let a: {} = 1 as {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:13: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let a: {} = 1 as {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:13-19: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:13-19: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let a: {} = 1 as {};
|
||||
|
||||
@@ -119,12 +115,8 @@ let a: {} = 1 as {};
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:32: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:32-40: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet]
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:32-40: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let n: {.x: ()} = {.x = ()} as {.x = ()};
|
||||
|
||||
|
||||
+4
-12
@@ -58,20 +58,12 @@ var reference: const X;
|
||||
let ptr: const X* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:24: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:24-37: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+4]]:22: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:22-30: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
|
||||
+65
-93
@@ -39,20 +39,12 @@ let value: X = Init();
|
||||
fn Use() {
|
||||
// TODO: These should probably be valid.
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+7]]:41: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-71: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-71: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+7]]:41: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+4]]:41: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-70: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-70: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X);
|
||||
//@dump-sem-ir-end
|
||||
@@ -70,46 +62,26 @@ var reference: Core.MaybeUnformed(X);
|
||||
let ptr: Core.MaybeUnformed(X)* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: var unused i: X = Init() as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var unused i: X = Init() as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-31: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-31: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var unused i: X = Init() as X;
|
||||
// TODO: The diagnostic should explain that the reason we can't perform this
|
||||
// conversion is due to the expression category.
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: var unused j: X = Init() unsafe as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: var unused j: X = Init() unsafe as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-38: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-38: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
var unused j: X = Init() unsafe as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused v: X = value as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:21: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused v: X = value as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-30: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused v: X = value as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:24: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:24-37: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+4]]:22: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:22-30: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
@@ -234,30 +206,30 @@ fn Use() {
|
||||
// CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.1 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.1 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc19_3.1 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc15_3.1 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt.925: %pattern_type.6cb = ref_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %self.patt.617: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt.925 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc19_3.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc15_3.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.b19: type = pattern_type %.f01 [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt.64e: %pattern_type.b19 = ref_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %self.patt.00a: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt.64e [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc19_3.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.3: type = fn_type @Destroy.WithSelf.Op.loc15_3.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.3: %Destroy.WithSelf.Op.type.ef016f.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt.0a9: %pattern_type.55d = ref_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %self.patt.280: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt.0a9 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc19_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc19_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.4: type = fn_type @Destroy.WithSelf.Op.loc15_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.4: %Destroy.WithSelf.Op.type.ef016f.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc19_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15_3.4 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.4: %Destroy.WithSelf.SelfDestruct.type.fbceb5.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -275,56 +247,56 @@ fn Use() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generated {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc19_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc15_3.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.6cb = ref_param_pattern [concrete = constants.%self.param_patt.925]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.617]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %X = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %X = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc19_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc15_3.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.6cb = ref_param_pattern [concrete = constants.%self.param_patt.925]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.6cb = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.617]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %X = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %X = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.3: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.3 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.3 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.3] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.b19 = ref_param_pattern [concrete = constants.%self.param_patt.64e]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.00a]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %.f01 = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %.f01 = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc19_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.3: %Destroy.WithSelf.Op.type.ef016f.3 = fn_decl @Destroy.WithSelf.Op.loc15_3.3 [concrete = constants.%Destroy.WithSelf.Op.403171.3] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.b19 = ref_param_pattern [concrete = constants.%self.param_patt.64e]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.b19 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.00a]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %.f01 = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %.f01 = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc19_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.4: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.4 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_3.4 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.4] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.55d = ref_param_pattern [concrete = constants.%self.param_patt.0a9]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.280]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: ref %MaybeUnformed.67f = ref_param call_param0
|
||||
// CHECK:STDOUT: %self: ref %MaybeUnformed.67f = wrapper_binding self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc19_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] {
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.4: %Destroy.WithSelf.Op.type.ef016f.4 = fn_decl @Destroy.WithSelf.Op.loc15_3.4 [concrete = constants.%Destroy.WithSelf.Op.403171.4] {
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.55d = ref_param_pattern [concrete = constants.%self.param_patt.0a9]
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.55d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.280]
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -337,19 +309,19 @@ fn Use() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %i.var: ref %MaybeUnformed.67f = var_storage %i.var_patt
|
||||
// CHECK:STDOUT: %Init.ref: %Init.type = name_ref Init, file.%Init.decl [concrete = constants.%Init]
|
||||
// CHECK:STDOUT: %.loc19_46: ref %X = temporary_storage
|
||||
// CHECK:STDOUT: %Init.call: init %X to %.loc19_46 = call %Init.ref()
|
||||
// CHECK:STDOUT: %Core.ref.loc19_51: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_70: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc19_48: %MaybeUnformed.67f = converted %Init.call, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_46: ref %X = temporary_storage
|
||||
// CHECK:STDOUT: %Init.call: init %X to %.loc15_46 = call %Init.ref()
|
||||
// CHECK:STDOUT: %Core.ref.loc15_51: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc15_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc15_70: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc15_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc15_48: %MaybeUnformed.67f = converted %Init.call, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %i.var, <error>
|
||||
// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc19_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc15_37: type = splice_block %MaybeUnformed.loc15_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc15_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc15_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc15_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc15_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %i: ref %MaybeUnformed.67f = wrapper_binding i, %i.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -357,16 +329,16 @@ fn Use() {
|
||||
// CHECK:STDOUT: %i.var_patt: %pattern_type.55d = var_pattern %i.patt [concrete = constants.%i.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %value.ref: %X = name_ref value, file.%value
|
||||
// CHECK:STDOUT: %Core.ref.loc27_50: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc27_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc27_69: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc27_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc27_47: %MaybeUnformed.67f = converted %value.ref, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc27_37: type = splice_block %MaybeUnformed.loc27_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc27_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc27_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc27_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc27_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %Core.ref.loc19_50: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_69: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: %.loc19_47: %MaybeUnformed.67f = converted %value.ref, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] {
|
||||
// CHECK:STDOUT: %Core.ref.loc19_17: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic]
|
||||
// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: %MaybeUnformed.67f = wrapper_binding v, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
@@ -377,47 +349,47 @@ fn Use() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.1(%self.param: ref %empty_struct_type) {
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.1(%self.param: ref %empty_struct_type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param)
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.2(%self.param: ref %X) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.2(%self.param: ref %X) {
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.2(%self.param: ref %X) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param)
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.3(%self.param: ref %.f01) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.3(%self.param: ref %.f01) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.3(%self.param: ref %.f01) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.3(%self.param)
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.3(%self.param)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc19_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc19_3.4(%self.param: ref %MaybeUnformed.67f) {
|
||||
// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_3.4(%self.param: ref %MaybeUnformed.67f) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.4(%self.param)
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.4(%self.param)
|
||||
|
||||
+6
-18
@@ -60,28 +60,16 @@ var reference: partial X;
|
||||
let ptr: partial X* = &reference;
|
||||
|
||||
fn Use() {
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:21: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused v: X = value as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:21: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused v: X = value as X;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:21-30: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused v: X = value as X;
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:24: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:24: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:24-37: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused a: X* = &(reference as X);
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+7]]:22: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+4]]:22: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let unused b: X* = ptr as X*;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:22-30: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let unused b: X* = ptr as X*;
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,12 +18,8 @@ class A {};
|
||||
class B {};
|
||||
|
||||
fn Convert(a: A) -> B {
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:10: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: return a unsafe as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:10: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return a unsafe as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:10-22: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:10-22: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
return a unsafe as B;
|
||||
}
|
||||
+2
-6
@@ -17,14 +17,10 @@
|
||||
// This regression test ensures that reuse of `<error>` in different scopes
|
||||
// works.
|
||||
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: fn Foo[runtime a: ()]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR:
|
||||
fn Foo[runtime a: ()]();
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+4]]:8: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR: fn Boo[runtime a: ()]() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant]
|
||||
// CHECK:STDERR:
|
||||
fn Boo[runtime a: ()]() {}
|
||||
|
||||
|
||||
+2
-6
@@ -16,9 +16,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Main() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:3: error: name `x` not found [NameNotFound]
|
||||
// CHECK:STDERR: x;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:3: error: name `x` not found [NameNotFound]
|
||||
// CHECK:STDERR:
|
||||
x;
|
||||
//@dump-sem-ir-end
|
||||
@@ -30,9 +28,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+4]]:3: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: true.b;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+2]]:3-8: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR:
|
||||
true.b;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -63,9 +63,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+4]]:8: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: var n: MakeArray(i32, -1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+2]]:8-25: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR:
|
||||
var n: MakeArray(i32, -1);
|
||||
|
||||
@@ -75,9 +73,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+4]]:8: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR: var n: MakeArray(i32, 0x1_0000_0000_0000_0000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+2]]:8-46: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge]
|
||||
// CHECK:STDERR:
|
||||
var n: MakeArray(i32, 0x1_0000_0000_0000_0000);
|
||||
|
||||
@@ -88,9 +84,7 @@ library "[[@TEST_NAME]]";
|
||||
import library "types";
|
||||
|
||||
fn F(n: Core.IntLiteral) {
|
||||
// CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+4]]:17: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: var unused a: MakeArray(i32, n);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+2]]:17-33: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR:
|
||||
var unused a: MakeArray(i32, n);
|
||||
}
|
||||
|
||||
+6
-18
@@ -41,34 +41,22 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn AddCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.add";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+11]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE-5]]:5: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE-3]]:5-18: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddCharInt('\u{10FFFF}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let b: CharLiteral = AddCharInt('\u{D7FF}', 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = AddCharInt('\u{D7FF}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let c: CharLiteral = AddCharInt('a', Negate(98));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = AddCharInt('a', Negate(98));
|
||||
|
||||
|
||||
@@ -26,21 +26,15 @@ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char";
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char";
|
||||
|
||||
@@ -50,13 +44,9 @@ library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
let c: CharLiteral = 'a';
|
||||
// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+8]]:18: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let d: UInt(8) = ToChar(c);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE-6]]:1: in import [InImport]
|
||||
// CHECK:STDERR: builtin.carbon:10:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+4]]:18-26: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_runtime_call.carbon:[[@LINE-4]]:1 [InImport]
|
||||
// CHECK:STDERR: builtin.carbon:10:1-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let d: UInt(8) = ToChar(c);
|
||||
|
||||
@@ -76,9 +66,7 @@ let c: UInt(8) = ToChar('\u{7F}');
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_size_small.carbon:[[@LINE+4]]:18: error: character value U+0080 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: let c: UInt(8) = ToChar('\u{80}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_size_small.carbon:[[@LINE+2]]:18-33: error: character value U+0080 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let c: UInt(8) = ToChar('\u{80}');
|
||||
|
||||
@@ -87,9 +75,7 @@ let c: UInt(8) = ToChar('\u{80}');
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "builtin";
|
||||
|
||||
// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+4]]:18: error: character value U+1E15 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: let c: UInt(8) = ToChar('\u{1E15}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+2]]:18-35: error: character value U+1E15 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let c: UInt(8) = ToChar('\u{1E15}');
|
||||
|
||||
|
||||
@@ -45,16 +45,10 @@ fn UInt(n: IntLiteral) -> type = "int.make_type_unsigned";
|
||||
|
||||
fn ConvertToU8(c: CharLiteral) -> UInt(8) = "char_literal.convert_int";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+11]]:13: error: character value U+0100 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:13-34: error: character value U+0100 too large for type `<builtin u8>` [CharTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+7]]:13: error: cannot implicitly convert expression of type `<builtin u8>` to `u8` [ConversionFailure]
|
||||
// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:13: note: type `<builtin u8>` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:13-34: error: cannot implicitly convert expression of type `<builtin u8>` to `u8` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:13-34: note: type `<builtin u8>` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
let g: u8 = ConvertToU8('\u{100}');
|
||||
|
||||
|
||||
@@ -42,15 +42,11 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn SubCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.sub_int";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let a: CharLiteral = SubCharInt('\u{0000}', 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = SubCharInt('\u{0000}', 1);
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-56: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1));
|
||||
|
||||
|
||||
@@ -58,16 +58,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class FailIncomplete;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+11]]:17: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class FailIncomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+5]]:17-33: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-3]]:1-21: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -80,9 +74,7 @@ class FailWrongArg {
|
||||
var end: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -95,9 +87,7 @@ class FailWrongArgCount {
|
||||
var end: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:1-58: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -105,9 +95,7 @@ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -119,9 +107,7 @@ class FailWrongFieldCount {
|
||||
var start: i32*;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -134,9 +120,7 @@ class FailWrongFirstField {
|
||||
var end: i32;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make";
|
||||
|
||||
@@ -149,8 +133,6 @@ class FailWrongSecondField {
|
||||
var end: {.a: i32};
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+2]]:1-53: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make";
|
||||
+3
-9
@@ -28,19 +28,13 @@ var x: f64 = Add(2.2, 2.3);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
fn JustRight(a: f64, b: f64) -> f64 = "float.add";
|
||||
|
||||
@@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.add_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.add_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
|
||||
@@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign";
|
||||
+32
-42
@@ -110,19 +110,13 @@ import library "f32";
|
||||
import library "f64";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType]
|
||||
// CHECK:STDERR: let a: f32 = Float64ToFloat32(1.0e39);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-37: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let a: f32 = Float64ToFloat32(1.0e39);
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: let b: f32 = FloatLiteralToFloat32(1.0e39);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-42: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let b: f32 = FloatLiteralToFloat32(1.0e39);
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+4]]:14: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: let c: f64 = FloatLiteralToFloat64(1.0e309);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-43: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let c: f64 = FloatLiteralToFloat64(1.0e309);
|
||||
//@dump-sem-ir-end
|
||||
@@ -144,13 +138,9 @@ import library "f64";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
let not_constant_64: f64 = 0.0;
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:33: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport]
|
||||
// CHECK:STDERR: f64.carbon:5:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn Float64ToFloat64(a: f64) -> f64 = "float.convert_checked";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:33-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport]
|
||||
// CHECK:STDERR: f64.carbon:5:1-36: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
//@dump-sem-ir-end
|
||||
@@ -625,24 +615,24 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc11_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc11_37.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc11: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc11_37.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc9_37.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc9: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc9_37.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.239 = value_binding_pattern a [concrete = constants.%a.patt.56d]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc16_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc16_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc16_42.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc16: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc16_42.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc12_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc12_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc12_42.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f32.loc12: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc]
|
||||
// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc12_42.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.239 = value_binding_pattern b [concrete = constants.%b.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc21_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc21_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc21_43.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc15_43.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc21_43.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc15_43.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.667 = value_binding_pattern c [concrete = constants.%c.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -651,21 +641,21 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Float64ToFloat32.ref: %Float64ToFloat32.type = name_ref Float64ToFloat32, imports.%Main.Float64ToFloat32 [concrete = constants.%Float64ToFloat32]
|
||||
// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1]
|
||||
// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1]
|
||||
// CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_31.1: <bound method> = bound_method %float.loc11, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc9_31.1: <bound method> = bound_method %float.loc9, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_31.2: <bound method> = bound_method %float.loc11, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc11_31.2(%float.loc11) [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc11_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc11_31.2: %f64.761 = converted %float.loc11, %.loc11_31.1 [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc11_31.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %bound_method.loc9_31.2: <bound method> = bound_method %float.loc9, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc9_31.2(%float.loc9) [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc9_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %.loc9_31.2: %f64.761 = converted %float.loc9, %.loc9_31.1 [concrete = constants.%float.8d8]
|
||||
// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc9_31.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.ref: %FloatLiteralToFloat32.type = name_ref FloatLiteralToFloat32, imports.%Main.FloatLiteralToFloat32 [concrete = constants.%FloatLiteralToFloat32]
|
||||
// CHECK:STDOUT: %float.loc16: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc16) [concrete = <error>]
|
||||
// CHECK:STDOUT: %float.loc12: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc12) [concrete = <error>]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.ref: %FloatLiteralToFloat64.type = name_ref FloatLiteralToFloat64, imports.%Main.FloatLiteralToFloat64 [concrete = constants.%FloatLiteralToFloat64]
|
||||
// CHECK:STDOUT: %float.loc21: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc21) [concrete = <error>]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f]
|
||||
// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc15) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -800,10 +790,10 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64);
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %not_constant_64.patt: %pattern_type.667 = value_binding_pattern not_constant_64 [concrete = constants.%not_constant_64.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc15_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call
|
||||
// CHECK:STDOUT: %.loc15_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc15_65.1
|
||||
// CHECK:STDOUT: %f64.loc15: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc15_65.2
|
||||
// CHECK:STDOUT: %.loc11_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call
|
||||
// CHECK:STDOUT: %.loc11_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc11_65.1
|
||||
// CHECK:STDOUT: %f64.loc11: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
|
||||
// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc11_65.2
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %convert_not_constant.patt: %pattern_type.667 = value_binding_pattern convert_not_constant [concrete = constants.%convert_not_constant.patt]
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+204
-238
@@ -96,104 +96,74 @@ library "[[@TEST_NAME]]";
|
||||
import library "float_to_int";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:21: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: let overflow: i32 = ConvertF64ToI32(2147483648.0);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-49: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let overflow: i32 = ConvertF64ToI32(2147483648.0);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-58: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0));
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:25: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR: let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:25-52: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0));
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:29: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:29-66: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0);
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:35: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:35-71: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:62: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:62-106: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR:
|
||||
let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-107: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000);
|
||||
|
||||
//
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:71: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR: let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:71-141: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt]
|
||||
// CHECK:STDERR:
|
||||
let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-82: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:42: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-80: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:46: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-85: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:44: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-75: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:48: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:48-81: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:42: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-72: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9);
|
||||
|
||||
//
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:46: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR: let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-79: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType]
|
||||
// CHECK:STDERR:
|
||||
let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32);
|
||||
//@dump-sem-ir-end
|
||||
@@ -203,15 +173,11 @@ library "[[@TEST_NAME]]";
|
||||
import library "float_to_int";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+4]]:20: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt]
|
||||
// CHECK:STDERR: let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt]
|
||||
// CHECK:STDERR:
|
||||
let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0));
|
||||
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+4]]:20: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt]
|
||||
// CHECK:STDERR: let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt]
|
||||
// CHECK:STDERR:
|
||||
let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
//@dump-sem-ir-end
|
||||
@@ -324,114 +290,114 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc9 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc9, %.loc9_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc9_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc7_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %overflow.patt: %pattern_type.d94 = value_binding_pattern overflow [concrete = constants.%overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc15_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc15 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc15, %.loc15_58.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc15_58.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_58.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc11_58.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %underflow.patt: %pattern_type.d94 = value_binding_pattern underflow [concrete = constants.%underflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc21_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc21_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc21_52.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc21: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc21_52.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc15_52.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc15: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc15_52.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %unsigned_neg.patt: %pattern_type.129 = value_binding_pattern unsigned_neg [concrete = constants.%unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc27_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc27 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc27_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc27, %.loc27_66.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc27_66.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc19 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc19, %.loc19_66.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc19_66.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow.patt: %pattern_type.d94 = value_binding_pattern literal_overflow [concrete = constants.%literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc33_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_71.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc33_71.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc23 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc23_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc23, %.loc23_71.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc23_71.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_literal_overflow [concrete = constants.%giant_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc40_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc40 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc40_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc40, %.loc40_106.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc40_48: type = splice_block %IntLiteral.ref.loc40 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc40: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc40: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %.loc28_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28, %.loc28_106.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_48: type = splice_block %IntLiteral.ref.loc28 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc28: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc28: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc40_106.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc28_106.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_literal_to_int_literal_overflow [concrete = constants.%giant_literal_to_int_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc47_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc47 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc47_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc47, %.loc47_107.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc47: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc47_107.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc33_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_107.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc33_107.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_exponent_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_exponent_literal_overflow [concrete = constants.%giant_exponent_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc55_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc55 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc55_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc55, %.loc55_141.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc55_57: type = splice_block %IntLiteral.ref.loc55 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc55: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc55: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: %.loc39_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc39_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39, %.loc39_141.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc39_57: type = splice_block %IntLiteral.ref.loc39 [concrete = Core.IntLiteral] {
|
||||
// CHECK:STDOUT: %Core.ref.loc39: <namespace> = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1]
|
||||
// CHECK:STDOUT: %IntLiteral.ref.loc39: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc55_141.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc39_141.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_exponent_literal_to_int_literal_overflow [concrete = constants.%giant_exponent_literal_to_int_literal_overflow.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc62_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc62 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc62_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc62, %.loc62_82.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc62: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc62_82.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc44_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc44 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc44_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc44, %.loc44_82.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc44: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc44_82.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_large_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_large_mantissa [concrete = constants.%literal_overflow_large_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc69_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc69 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc69_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc69, %.loc69_80.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc69: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc69_80.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc49_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc49 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc49_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc49, %.loc49_80.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc49_80.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_med_mantissa [concrete = constants.%literal_overflow_med_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc76_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc76 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc76_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc76, %.loc76_85.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc76: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc76_85.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc54_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc54 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc54_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc54, %.loc54_85.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc54_85.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_hex_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_hex_med_mantissa [concrete = constants.%literal_overflow_hex_med_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc83_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc83 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc83_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc83, %.loc83_75.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc83: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc83_75.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc59_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc59 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc59_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc59, %.loc59_75.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc59_75.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_small_mantissa [concrete = constants.%literal_overflow_small_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc90_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc90 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc90_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc90, %.loc90_81.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc90: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc90_81.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc64_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc64 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc64_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc64, %.loc64_81.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc64: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc64_81.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_bin_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_bin_small_mantissa [concrete = constants.%literal_overflow_bin_small_mantissa.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc97_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc97 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc97_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc97, %.loc97_72.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc97: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc97_72.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc69_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc69 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc69_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc69, %.loc69_72.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc69: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc69_72.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_unsigned_neg [concrete = constants.%literal_overflow_unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc104_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc104 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc104_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc104, %.loc104_79.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc104: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc104_79.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc74_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc74 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc74_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc74, %.loc74_79.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %u32.loc74: type = type_literal constants.%u32 [concrete = constants.%u32]
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc74_79.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_bin_unsigned_neg [concrete = constants.%literal_overflow_bin_unsigned_neg.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -439,80 +405,80 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc9: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc9_37.1: <bound method> = bound_method %float.loc9, %impl.elem0.loc9 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb]
|
||||
// CHECK:STDOUT: %specific_fn.loc9: <specific function> = specific_function %impl.elem0.loc9, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_37.2: <bound method> = bound_method %float.loc9, %specific_fn.loc9 [concrete = constants.%bound_method.847]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %f64.761 = call %bound_method.loc9_37.2(%float.loc9) [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc9_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc9_37.2: %f64.761 = converted %float.loc9, %.loc9_37.1 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc9: init %i32 = call %ConvertF64ToI32.ref.loc9(%.loc9_37.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc15: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc15_45.1: <bound method> = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d]
|
||||
// CHECK:STDOUT: %specific_fn.loc15: <specific function> = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_45.2: <bound method> = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.a16]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_45.2(%float.loc15) [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc15_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc15_45.2: %f64.761 = converted %float.loc15, %.loc15_45.1 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_45.2) [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc15_57.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc15_57.2: %f64.761 = converted %Negate.call.loc15, %.loc15_57.1 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc15: init %i32 = call %ConvertF64ToI32.ref.loc15(%.loc15_57.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %float.loc7: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_37.1: <bound method> = bound_method %float.loc7, %impl.elem0.loc7 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb]
|
||||
// CHECK:STDOUT: %specific_fn.loc7: <specific function> = specific_function %impl.elem0.loc7, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_37.2: <bound method> = bound_method %float.loc7, %specific_fn.loc7 [concrete = constants.%bound_method.847]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %f64.761 = call %bound_method.loc7_37.2(%float.loc7) [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc7_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %.loc7_37.2: %f64.761 = converted %float.loc7, %.loc7_37.1 [concrete = constants.%float.ab7]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_37.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc11: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.1: <bound method> = bound_method %float.loc11, %impl.elem0.loc11 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d]
|
||||
// CHECK:STDOUT: %specific_fn.loc11: <specific function> = specific_function %impl.elem0.loc11, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.2: <bound method> = bound_method %float.loc11, %specific_fn.loc11 [concrete = constants.%bound_method.a16]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11) [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11, %.loc11_45.1 [concrete = constants.%float.8e0]
|
||||
// CHECK:STDOUT: %Negate.call.loc11: init %f64.761 = call %Negate.ref.loc11(%.loc11_45.2) [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc11_57.1: %f64.761 = value_of_initializer %Negate.call.loc11 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %.loc11_57.2: %f64.761 = converted %Negate.call.loc11, %.loc11_57.1 [concrete = constants.%float.5e1]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_57.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.ref: %ConvertF64ToU32.type = name_ref ConvertF64ToU32, imports.%Main.ConvertF64ToU32 [concrete = constants.%ConvertF64ToU32]
|
||||
// CHECK:STDOUT: %Negate.ref.loc21: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc21: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %impl.elem0.loc21: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc21_48.1: <bound method> = bound_method %float.loc21, %impl.elem0.loc21 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc21: <specific function> = specific_function %impl.elem0.loc21, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc21_48.2: <bound method> = bound_method %float.loc21, %specific_fn.loc21 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %f64.761 = call %bound_method.loc21_48.2(%float.loc21) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc21_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc21_48.2: %f64.761 = converted %float.loc21, %.loc21_48.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %Negate.call.loc21: init %f64.761 = call %Negate.ref.loc21(%.loc21_48.2) [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc21_51.1: %f64.761 = value_of_initializer %Negate.call.loc21 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc21_51.2: %f64.761 = converted %Negate.call.loc21, %.loc21_51.1 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc21_51.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc27: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc27: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc27: init %i32 = call %ConvertFloatLiteralToI32.ref.loc27(%float.loc27) [concrete = <error>]
|
||||
// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate]
|
||||
// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc15_48.1: <bound method> = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc15: <specific function> = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_48.2: <bound method> = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_48.2(%float.loc15) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %float.loc15, %.loc15_48.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_48.2) [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc15_51.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %.loc15_51.2: %f64.761 = converted %Negate.call.loc15, %.loc15_51.1 [concrete = constants.%float.c4b]
|
||||
// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc15_51.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc19: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc19: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc19: init %i32 = call %ConvertFloatLiteralToI32.ref.loc19(%float.loc19) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc23: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc23: init %i32 = call %ConvertFloatLiteralToI32.ref.loc23(%float.loc23) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc28: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc28: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc28: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc28(%float.loc28) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc33: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d]
|
||||
// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc33: init %i32 = call %ConvertFloatLiteralToI32.ref.loc33(%float.loc33) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc40: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc40: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc40: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc40(%float.loc40) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc47: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc47: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc47: init %i32 = call %ConvertFloatLiteralToI32.ref.loc47(%float.loc47) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc55: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc55: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc55: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc55(%float.loc55) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc62: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc62: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc62: init %i32 = call %ConvertFloatLiteralToI32.ref.loc62(%float.loc62) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc69: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc69: init %i32 = call %ConvertFloatLiteralToI32.ref.loc69(%float.loc69) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc76: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc76: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc76: init %i32 = call %ConvertFloatLiteralToI32.ref.loc76(%float.loc76) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc83: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc83: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc83: init %i32 = call %ConvertFloatLiteralToI32.ref.loc83(%float.loc83) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc90: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc90: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc90: init %i32 = call %ConvertFloatLiteralToI32.ref.loc90(%float.loc90) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc97: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc97: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc97: init %u32 = call %ConvertFloatLiteralToU32.ref.loc97(%float.loc97) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc104: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc104: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc104: init %u32 = call %ConvertFloatLiteralToU32.ref.loc104(%float.loc104) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc39: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral]
|
||||
// CHECK:STDOUT: %float.loc39: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc39: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc39(%float.loc39) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc44: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc44: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc44: init %i32 = call %ConvertFloatLiteralToI32.ref.loc44(%float.loc44) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc49: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc49: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc49: init %i32 = call %ConvertFloatLiteralToI32.ref.loc49(%float.loc49) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc54: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc54: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc54: init %i32 = call %ConvertFloatLiteralToI32.ref.loc54(%float.loc54) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc59: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc59: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc59: init %i32 = call %ConvertFloatLiteralToI32.ref.loc59(%float.loc59) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc64: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32]
|
||||
// CHECK:STDOUT: %float.loc64: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc64: init %i32 = call %ConvertFloatLiteralToI32.ref.loc64(%float.loc64) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc69: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc69: init %u32 = call %ConvertFloatLiteralToU32.ref.loc69(%float.loc69) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc74: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32]
|
||||
// CHECK:STDOUT: %float.loc74: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b]
|
||||
// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc74: init %u32 = call %ConvertFloatLiteralToU32.ref.loc74(%float.loc74) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -568,17 +534,17 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc9 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc9, %.loc9_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc9_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc7_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %nan_val.patt: %pattern_type.d94 = value_binding_pattern nan_val [concrete = constants.%nan_val.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc15_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc15 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc15, %.loc15_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc15_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc11_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_49.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc11_49.2 [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %inf_val.patt: %pattern_type.d94 = value_binding_pattern inf_val [concrete = constants.%inf_val.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -586,50 +552,50 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0));
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc9: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc9: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc9_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1]
|
||||
// CHECK:STDOUT: %float.loc9_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc9_40.1: <bound method> = bound_method %float.loc9_40, %impl.elem0.loc9_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1]
|
||||
// CHECK:STDOUT: %specific_fn.loc9_40: <specific function> = specific_function %impl.elem0.loc9_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_40.2: <bound method> = bound_method %float.loc9_40, %specific_fn.loc9_40 [concrete = constants.%bound_method.49396d.1]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_40: init %f64.761 = call %bound_method.loc9_40.2(%float.loc9_40) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc9_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_40 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc9_40.2: %f64.761 = converted %float.loc9_40, %.loc9_40.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc9_45.1: <bound method> = bound_method %float.loc9_45, %impl.elem0.loc9_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2]
|
||||
// CHECK:STDOUT: %specific_fn.loc9_45: <specific function> = specific_function %impl.elem0.loc9_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_45.2: <bound method> = bound_method %float.loc9_45, %specific_fn.loc9_45 [concrete = constants.%bound_method.49396d.2]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_45: init %f64.761 = call %bound_method.loc9_45.2(%float.loc9_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc9_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc9_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc9_45.2: %f64.761 = converted %float.loc9_45, %.loc9_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc9: init %f64.761 = call %Div.ref.loc9(%.loc9_40.2, %.loc9_45.2) [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc9_48.1: %f64.761 = value_of_initializer %Div.call.loc9 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc9_48.2: %f64.761 = converted %Div.call.loc9, %.loc9_48.1 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc9: init %i32 = call %ConvertF64ToI32.ref.loc9(%.loc9_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc15: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc15: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc15_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %float.loc15_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc15_40.1: <bound method> = bound_method %float.loc15_40, %impl.elem0.loc15_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc15_40: <specific function> = specific_function %impl.elem0.loc15_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_40.2: <bound method> = bound_method %float.loc15_40, %specific_fn.loc15_40 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_40: init %f64.761 = call %bound_method.loc15_40.2(%float.loc15_40) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_40 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc15_40.2: %f64.761 = converted %float.loc15_40, %.loc15_40.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc15_45.1: <bound method> = bound_method %float.loc15_45, %impl.elem0.loc15_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3]
|
||||
// CHECK:STDOUT: %specific_fn.loc15_45: <specific function> = specific_function %impl.elem0.loc15_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_45.2: <bound method> = bound_method %float.loc15_45, %specific_fn.loc15_45 [concrete = constants.%bound_method.49396d.3]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_45: init %f64.761 = call %bound_method.loc15_45.2(%float.loc15_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc15_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc15_45.2: %f64.761 = converted %float.loc15_45, %.loc15_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc15: init %f64.761 = call %Div.ref.loc15(%.loc15_40.2, %.loc15_45.2) [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Div.call.loc15 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %Div.call.loc15, %.loc15_48.1 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc15: init %i32 = call %ConvertF64ToI32.ref.loc15(%.loc15_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc7: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc7_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1]
|
||||
// CHECK:STDOUT: %float.loc7_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_40.1: <bound method> = bound_method %float.loc7_40, %impl.elem0.loc7_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1]
|
||||
// CHECK:STDOUT: %specific_fn.loc7_40: <specific function> = specific_function %impl.elem0.loc7_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_40.2: <bound method> = bound_method %float.loc7_40, %specific_fn.loc7_40 [concrete = constants.%bound_method.49396d.1]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40: init %f64.761 = call %bound_method.loc7_40.2(%float.loc7_40) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_40.2: %f64.761 = converted %float.loc7_40, %.loc7_40.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc7_45.1: <bound method> = bound_method %float.loc7_45, %impl.elem0.loc7_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2]
|
||||
// CHECK:STDOUT: %specific_fn.loc7_45: <specific function> = specific_function %impl.elem0.loc7_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc7_45.2: <bound method> = bound_method %float.loc7_45, %specific_fn.loc7_45 [concrete = constants.%bound_method.49396d.2]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45: init %f64.761 = call %bound_method.loc7_45.2(%float.loc7_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc7_45.2: %f64.761 = converted %float.loc7_45, %.loc7_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc7: init %f64.761 = call %Div.ref.loc7(%.loc7_40.2, %.loc7_45.2) [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc7_48.1: %f64.761 = value_of_initializer %Div.call.loc7 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %.loc7_48.2: %f64.761 = converted %Div.call.loc7, %.loc7_48.1 [concrete = constants.%float.61c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32]
|
||||
// CHECK:STDOUT: %Div.ref.loc11: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div]
|
||||
// CHECK:STDOUT: %float.loc11_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
|
||||
// CHECK:STDOUT: %float.loc11_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_40.1: <bound method> = bound_method %float.loc11_40, %impl.elem0.loc11_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9]
|
||||
// CHECK:STDOUT: %specific_fn.loc11_40: <specific function> = specific_function %impl.elem0.loc11_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_40.2: <bound method> = bound_method %float.loc11_40, %specific_fn.loc11_40 [concrete = constants.%bound_method.04a]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40: init %f64.761 = call %bound_method.loc11_40.2(%float.loc11_40) [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc11_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %.loc11_40.2: %f64.761 = converted %float.loc11_40, %.loc11_40.1 [concrete = constants.%float.a71]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.1: <bound method> = bound_method %float.loc11_45, %impl.elem0.loc11_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3]
|
||||
// CHECK:STDOUT: %specific_fn.loc11_45: <specific function> = specific_function %impl.elem0.loc11_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc11_45.2: <bound method> = bound_method %float.loc11_45, %specific_fn.loc11_45 [concrete = constants.%bound_method.49396d.3]
|
||||
// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11_45) [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11_45, %.loc11_45.1 [concrete = constants.%float.73e]
|
||||
// CHECK:STDOUT: %Div.call.loc11: init %f64.761 = call %Div.ref.loc11(%.loc11_40.2, %.loc11_45.2) [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc11_48.1: %f64.761 = value_of_initializer %Div.call.loc11 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %.loc11_48.2: %f64.761 = converted %Div.call.loc11, %.loc11_48.1 [concrete = constants.%float.62c]
|
||||
// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_48.2) [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
+4
-12
@@ -30,9 +30,7 @@ let c: f64 = Div(0.0, 0.0);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.div";
|
||||
|
||||
@@ -44,9 +42,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
|
||||
@@ -58,9 +54,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
|
||||
@@ -73,9 +67,7 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div";
|
||||
|
||||
|
||||
@@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.div_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.div_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
|
||||
@@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";
|
||||
+2
-6
@@ -32,9 +32,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
|
||||
@@ -42,9 +40,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-59: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq";
|
||||
|
||||
|
||||
+1
-3
@@ -36,9 +36,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-63: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq";
|
||||
|
||||
|
||||
@@ -39,9 +39,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth]
|
||||
// CHECK:STDERR: var invalid_float: Float(931);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+2]]:20-29: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth]
|
||||
// CHECK:STDERR:
|
||||
var invalid_float: Float(931);
|
||||
|
||||
@@ -52,9 +50,7 @@ library "[[@TEST_NAME]]";
|
||||
import library "types";
|
||||
|
||||
var dyn_size: i32 = 64;
|
||||
// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+4]]:10: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: var dyn: Float(dyn_size);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+2]]:10-24: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR:
|
||||
var dyn: Float(dyn_size);
|
||||
|
||||
|
||||
+4
-12
@@ -28,9 +28,7 @@ var x: f64 = Mul(2.0, 0.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
|
||||
@@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
|
||||
@@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
|
||||
@@ -71,9 +65,7 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul";
|
||||
|
||||
|
||||
@@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.mul_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.mul_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
|
||||
@@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign";
|
||||
+3
-9
@@ -28,9 +28,7 @@ let a: f64 = Negate(1.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> f64 = "float.negate";
|
||||
|
||||
@@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew() -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
|
||||
@@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
|
||||
|
||||
+1
-3
@@ -34,9 +34,7 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
|
||||
|
||||
+3
-9
@@ -28,9 +28,7 @@ var x: f64 = Sub(2.0, 0.5);
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
|
||||
@@ -42,9 +40,7 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
|
||||
@@ -56,9 +52,7 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
|
||||
|
||||
@@ -24,15 +24,11 @@ fn Call(ref a: f64, b: f64) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.sub_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: f64, b: f64) = "float.sub_assign";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
|
||||
@@ -41,8 +37,6 @@ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Literal() -> type = "float_literal.make_type";
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign";
|
||||
@@ -42,9 +42,7 @@ library "[[@TEST_NAME]]";
|
||||
fn Add(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.add";
|
||||
|
||||
fn F(){
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+4]]:6: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: Add(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:6-52: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR:
|
||||
Add(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
fn Sub(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.sub";
|
||||
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+4]]:29: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR: let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:29-75: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange]
|
||||
// CHECK:STDERR:
|
||||
let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001);
|
||||
|
||||
|
||||
@@ -36,9 +36,7 @@ alias IntLiteral = MakeIntLiteral();
|
||||
|
||||
fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal";
|
||||
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:22: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddIntChar(0x10000000000000, 'a');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddIntChar(0x10000000000000, 'a');
|
||||
|
||||
@@ -54,21 +52,15 @@ alias IntLiteral = MakeIntLiteral();
|
||||
fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal";
|
||||
fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let a: CharLiteral = AddIntChar(1, '\u{10FFFF}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = AddIntChar(1, '\u{10FFFF}');
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let b: CharLiteral = AddIntChar(1, '\u{D7FF}');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = AddIntChar(1, '\u{D7FF}');
|
||||
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+4]]:22: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR: let c: CharLiteral = AddIntChar(Negate(98), 'a');
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult]
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = AddIntChar(Negate(98), 'a');
|
||||
|
||||
|
||||
+12
-36
@@ -52,12 +52,8 @@ library "[[@TEST_NAME]]";
|
||||
fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
|
||||
fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: return AndLit(5, a);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-21: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-70: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
return AndLit(5, a);
|
||||
}
|
||||
@@ -67,24 +63,16 @@ fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// Heterogeneous "and" is not supported.
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and";
|
||||
|
||||
@@ -97,28 +85,16 @@ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
fn Test(n: Core.IntLiteral) {
|
||||
// OK
|
||||
And(1, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: And(n, 1);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
And(n, 1);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: And(1, n);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
And(1, n);
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: And(n, n);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
And(n, n);
|
||||
}
|
||||
|
||||
+3
-9
@@ -26,9 +26,7 @@ fn Call(ref a: i32, b: i32) {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
|
||||
@@ -36,9 +34,7 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
|
||||
@@ -48,9 +44,7 @@ fn NotRef(a: i32, b: i32) = "int.and_assign";
|
||||
//
|
||||
// library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.and_assign";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR:
|
||||
fn MixedTypes(ref a: i32, b: i64) = "int.and_assign";
|
||||
|
||||
|
||||
+2
-6
@@ -52,12 +52,8 @@ library "[[@TEST_NAME]]";
|
||||
fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement";
|
||||
|
||||
fn F(a: Core.IntLiteral) -> Core.IntLiteral {
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: return Complement(a);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-22: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
return Complement(a);
|
||||
}
|
||||
|
||||
+5
-13
@@ -76,12 +76,8 @@ import library "int_ops";
|
||||
|
||||
fn F() {
|
||||
// Ensure our testing machinery works.
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+7]]:3: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+4]]:3: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+3]]:3-43: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: fail_self_test.carbon:[[@LINE+2]]:3-43: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR:
|
||||
Test(Int32ToInt32(0)) as Expect(1 as i32);
|
||||
}
|
||||
@@ -245,13 +241,9 @@ import library "int_ops";
|
||||
|
||||
let not_constant: Core.IntLiteral = 0;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:33: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let convert_not_constant: i16 = IntLiteralToInt16(not_constant);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:16:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn IntLiteralToInt16(a: Core.IntLiteral) -> i16 = "int.convert";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:33-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:16:1-49: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant: i16 = IntLiteralToInt16(not_constant);
|
||||
|
||||
|
||||
@@ -40,21 +40,15 @@ alias IntLiteral = MakeIntLiteral();
|
||||
|
||||
fn ConvertFromIntLiteral(n: IntLiteral) -> CharLiteral = "int.convert_char_literal";
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: let a: CharLiteral = ConvertFromIntLiteral(-1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-46: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR:
|
||||
let a: CharLiteral = ConvertFromIntLiteral(-1);
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: let b: CharLiteral = ConvertFromIntLiteral(0xD800);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-50: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR:
|
||||
let b: CharLiteral = ConvertFromIntLiteral(0xD800);
|
||||
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:22: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR: let c: CharLiteral = ConvertFromIntLiteral(0x110000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-52: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue]
|
||||
// CHECK:STDERR:
|
||||
let c: CharLiteral = ConvertFromIntLiteral(0x110000);
|
||||
|
||||
|
||||
+18
-48
@@ -130,9 +130,7 @@ library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
let max_plus_one: i32 =
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+4]]:3: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
|
||||
// CHECK:STDERR: Uint32ToInt32(
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+2]]:3-16: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
Uint32ToInt32(
|
||||
AddU32(Int32ToUint32(0x7FFF_FFFF),
|
||||
@@ -143,9 +141,7 @@ let max_plus_one: i32 =
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+2]]:25-44: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
|
||||
@@ -154,9 +150,7 @@ let max_plus_one: i16 = Int32ToInt16(0x8000);
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+2]]:25-47: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
|
||||
@@ -165,9 +159,7 @@ let max_plus_one: u16 = Int32ToUint16(0x1_0000);
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+4]]:25: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+2]]:25-60: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
|
||||
@@ -176,9 +168,7 @@ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+4]]:25: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+2]]:25-63: error: integer value 65536 too large for type `u16` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
|
||||
@@ -187,9 +177,7 @@ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
|
||||
@@ -198,9 +186,7 @@ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
|
||||
@@ -209,9 +195,7 @@ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+4]]:29: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR:
|
||||
let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
|
||||
@@ -220,9 +204,7 @@ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1));
|
||||
library "[[@TEST_NAME]]";
|
||||
import library "int_ops";
|
||||
|
||||
// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+4]]:26: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR: let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+2]]:26-56: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
|
||||
// CHECK:STDERR:
|
||||
let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001));
|
||||
|
||||
@@ -233,33 +215,21 @@ import library "int_ops";
|
||||
|
||||
let not_constant: i32 = 0;
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:40: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-7]]:1: in import [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:19:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:40-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-5]]:1 [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:19:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant);
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-17]]:1: in import [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:11:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:38-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-11]]:1 [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:11:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_same: i32 = Int32ToInt32(not_constant);
|
||||
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+8]]:39: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE-27]]:1: in import [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:27:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+4]]:39-64: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: imported from: fail_not_constant.carbon:[[@LINE-17]]:1 [InImport]
|
||||
// CHECK:STDERR: int_ops.carbon:27:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR:
|
||||
let convert_not_constant_widen: i64 = Int32ToInt64(not_constant);
|
||||
|
||||
|
||||
Loaded 100 of 1205 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user