mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Removing extra private tag references
This commit is contained in:
parent
cf8409dfaa
commit
2ab01107d3
4 changed files with 4 additions and 48 deletions
|
@ -2209,18 +2209,6 @@ pub mod test_constrain {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn constrain_private_tag() {
|
|
||||||
infer_eq(
|
|
||||||
indoc!(
|
|
||||||
r#"
|
|
||||||
@Foo
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
"[ @Foo ]*",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn constrain_call_and_accessor() {
|
fn constrain_call_and_accessor() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
|
|
|
@ -223,7 +223,6 @@ pub enum BadIdent {
|
||||||
WeirdDotAccess(Position),
|
WeirdDotAccess(Position),
|
||||||
WeirdDotQualified(Position),
|
WeirdDotQualified(Position),
|
||||||
StrayDot(Position),
|
StrayDot(Position),
|
||||||
BadPrivateTag(Position),
|
|
||||||
BadOpaqueRef(Position),
|
BadOpaqueRef(Position),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -925,13 +925,10 @@ fn to_bad_ident_expr_report<'b>(
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
BadPrivateTag(pos) | BadOpaqueRef(pos) => {
|
BadOpaqueRef(pos) => {
|
||||||
use BadIdentNext::*;
|
use BadIdentNext::*;
|
||||||
let kind = if matches!(bad_ident, BadPrivateTag(..)) {
|
let kind = "an opaque reference";
|
||||||
"a private tag"
|
|
||||||
} else {
|
|
||||||
"an opaque reference"
|
|
||||||
};
|
|
||||||
match what_is_next(alloc.src_lines, lines.convert_pos(pos)) {
|
match what_is_next(alloc.src_lines, lines.convert_pos(pos)) {
|
||||||
LowercaseAccess(width) => {
|
LowercaseAccess(width) => {
|
||||||
let region = Region::new(pos, pos.bump_column(width));
|
let region = Region::new(pos, pos.bump_column(width));
|
||||||
|
@ -983,7 +980,7 @@ fn to_bad_ident_expr_report<'b>(
|
||||||
alloc.reflow(r"But after the "),
|
alloc.reflow(r"But after the "),
|
||||||
alloc.keyword("@"),
|
alloc.keyword("@"),
|
||||||
alloc.reflow(r" symbol I found a lowercase letter. "),
|
alloc.reflow(r" symbol I found a lowercase letter. "),
|
||||||
alloc.reflow(r"All tag names (global and private)"),
|
alloc.reflow(r"All opaque references "),
|
||||||
alloc.reflow(r" must start with an uppercase letter, like "),
|
alloc.reflow(r" must start with an uppercase letter, like "),
|
||||||
alloc.parser_suggestion("@UUID"),
|
alloc.parser_suggestion("@UUID"),
|
||||||
alloc.reflow(" or "),
|
alloc.reflow(" or "),
|
||||||
|
|
|
@ -38,17 +38,6 @@ fn hint_for_tag_name<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hint_for_private_tag_name<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
|
||||||
alloc.concat([
|
|
||||||
alloc.hint("Private tag names "),
|
|
||||||
alloc.reflow("start with an `@` symbol followed by an uppercase letter, like "),
|
|
||||||
alloc.parser_suggestion("@UID"),
|
|
||||||
alloc.text(" or "),
|
|
||||||
alloc.parser_suggestion("@SecretKey"),
|
|
||||||
alloc.text("."),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
fn record_patterns_look_like<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
fn record_patterns_look_like<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
||||||
alloc.concat([
|
alloc.concat([
|
||||||
alloc.reflow(r"Record pattern look like "),
|
alloc.reflow(r"Record pattern look like "),
|
||||||
|
@ -2475,23 +2464,6 @@ fn to_ttag_union_report<'a>(
|
||||||
severity: Severity::RuntimeError,
|
severity: Severity::RuntimeError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Next::Other(Some('@')) => {
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I am partway through parsing a tag union type, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.reflow(r"I was expecting to see a private tag name."),
|
|
||||||
hint_for_private_tag_name(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "WEIRD TAG NAME".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
let doc = alloc.stack([
|
let doc = alloc.stack([
|
||||||
alloc.reflow(r"I am partway through parsing a tag union type, but I got stuck here:"),
|
alloc.reflow(r"I am partway through parsing a tag union type, but I got stuck here:"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue