mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-17 01:05:02 +00:00
Warnings are now yellow
This commit is contained in:
parent
0e1a9545c6
commit
a189e3ab20
7 changed files with 580 additions and 426 deletions
|
@ -4771,7 +4771,7 @@ mod test_reporting {
|
|||
// TODO investigate this test. It was disabled in https://github.com/roc-lang/roc/pull/6634
|
||||
// as the way Defs without final expressions are handled. The changes probably shouldn't have
|
||||
// changed this error report. The exact same test_syntax test for this has not changed, so
|
||||
// we know the parser is parsing thesame thing. Therefore the way the AST is desugared must be
|
||||
// we know the parser is parsing the same thing. Therefore the way the AST is desugared must be
|
||||
// the cause of the change in error report.
|
||||
// test_report!(
|
||||
// def_missing_final_expression,
|
||||
|
@ -8162,7 +8162,7 @@ In roc, functions are always written as a lambda, like{}
|
|||
"#
|
||||
),
|
||||
// TODO(opaques): error could be improved by saying that the opaque definition demands
|
||||
// that the argument be a U8, and linking to the definitin!
|
||||
// that the argument be a U8, and linking to the definition!
|
||||
@r#"
|
||||
── TYPE MISMATCH in /code/proj/Main.roc ────────────────────────────────────────
|
||||
|
||||
|
@ -13530,7 +13530,7 @@ In roc, functions are always written as a lambda, like{}
|
|||
4│ crash "" ""
|
||||
^^^^^
|
||||
|
||||
`crash` must be given exacly one message to crash with.
|
||||
`crash` must be given exactly one message to crash with.
|
||||
"#
|
||||
);
|
||||
|
||||
|
|
|
@ -6303,6 +6303,8 @@ fn to_incorrect_module_name_report<'a>(
|
|||
expected,
|
||||
} = problem;
|
||||
|
||||
let severity = Severity::RuntimeError;
|
||||
|
||||
// SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather
|
||||
// than an incorrect module name problem (the latter can happen only after parsing).
|
||||
let src = unsafe { from_utf8_unchecked(src) };
|
||||
|
@ -6317,7 +6319,7 @@ fn to_incorrect_module_name_report<'a>(
|
|||
|
||||
let doc = alloc.stack([
|
||||
alloc.reflow("This module has a different name than I expected:"),
|
||||
alloc.region(lines.convert_region(found.region)),
|
||||
alloc.region(lines.convert_region(found.region), severity),
|
||||
alloc.reflow("Based on the nesting and use of this module, I expect it to have name"),
|
||||
alloc.pq_module_name(expected).indent(4),
|
||||
]);
|
||||
|
@ -6326,7 +6328,7 @@ fn to_incorrect_module_name_report<'a>(
|
|||
filename,
|
||||
doc,
|
||||
title: "INCORRECT MODULE NAME".to_string(),
|
||||
severity: Severity::RuntimeError,
|
||||
severity,
|
||||
};
|
||||
|
||||
let mut buf = String::new();
|
||||
|
@ -6346,6 +6348,7 @@ fn to_no_platform_package_report(
|
|||
) -> String {
|
||||
use roc_reporting::report::{Report, RocDocAllocator, DEFAULT_PALETTE};
|
||||
use ven_pretty::DocAllocator;
|
||||
let severity = Severity::RuntimeError;
|
||||
|
||||
// SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather
|
||||
// than an incorrect module name problem (the latter can happen only after parsing).
|
||||
|
@ -6361,7 +6364,7 @@ fn to_no_platform_package_report(
|
|||
|
||||
let doc = alloc.stack([
|
||||
alloc.reflow("This app does not specify a platform:"),
|
||||
alloc.region(lines.convert_region(region)),
|
||||
alloc.region(lines.convert_region(region),severity),
|
||||
alloc.reflow("Make sure you have exactly one package specified as `platform`:"),
|
||||
alloc
|
||||
.parser_suggestion(" app [main] {\n pf: platform \"…path or URL to platform…\"\n ^^^^^^^^\n }"),
|
||||
|
@ -6373,7 +6376,7 @@ fn to_no_platform_package_report(
|
|||
filename,
|
||||
doc,
|
||||
title: "UNSPECIFIED PLATFORM".to_string(),
|
||||
severity: Severity::RuntimeError,
|
||||
severity,
|
||||
};
|
||||
|
||||
let mut buf = String::new();
|
||||
|
@ -6393,6 +6396,7 @@ fn to_multiple_platform_packages_report(
|
|||
) -> String {
|
||||
use roc_reporting::report::{Report, RocDocAllocator, DEFAULT_PALETTE};
|
||||
use ven_pretty::DocAllocator;
|
||||
let severity = Severity::RuntimeError;
|
||||
|
||||
// SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather
|
||||
// than an incorrect module name problem (the latter can happen only after parsing).
|
||||
|
@ -6408,7 +6412,7 @@ fn to_multiple_platform_packages_report(
|
|||
|
||||
let doc = alloc.stack([
|
||||
alloc.reflow("This app specifies multiple packages as `platform`:"),
|
||||
alloc.region(lines.convert_region(region)),
|
||||
alloc.region(lines.convert_region(region), severity),
|
||||
alloc.reflow("Roc apps must specify exactly one platform."),
|
||||
]);
|
||||
|
||||
|
@ -6416,7 +6420,7 @@ fn to_multiple_platform_packages_report(
|
|||
filename,
|
||||
doc,
|
||||
title: "MULTIPLE PLATFORMS".to_string(),
|
||||
severity: Severity::RuntimeError,
|
||||
severity,
|
||||
};
|
||||
|
||||
let mut buf = String::new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue