mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
Removing extra private tag references
This commit is contained in:
parent
cf8409dfaa
commit
2ab01107d3
@ -2209,18 +2209,6 @@ pub mod test_constrain {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn constrain_private_tag() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
@Foo
|
||||
"#
|
||||
),
|
||||
"[ @Foo ]*",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn constrain_call_and_accessor() {
|
||||
infer_eq(
|
||||
|
@ -223,7 +223,6 @@ pub enum BadIdent {
|
||||
WeirdDotAccess(Position),
|
||||
WeirdDotQualified(Position),
|
||||
StrayDot(Position),
|
||||
BadPrivateTag(Position),
|
||||
BadOpaqueRef(Position),
|
||||
}
|
||||
|
||||
|
@ -925,13 +925,10 @@ fn to_bad_ident_expr_report<'b>(
|
||||
])
|
||||
}
|
||||
|
||||
BadPrivateTag(pos) | BadOpaqueRef(pos) => {
|
||||
BadOpaqueRef(pos) => {
|
||||
use BadIdentNext::*;
|
||||
let kind = if matches!(bad_ident, BadPrivateTag(..)) {
|
||||
"a private tag"
|
||||
} else {
|
||||
"an opaque reference"
|
||||
};
|
||||
let kind = "an opaque reference";
|
||||
|
||||
match what_is_next(alloc.src_lines, lines.convert_pos(pos)) {
|
||||
LowercaseAccess(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.keyword("@"),
|
||||
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.parser_suggestion("@UUID"),
|
||||
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> {
|
||||
alloc.concat([
|
||||
alloc.reflow(r"Record pattern look like "),
|
||||
@ -2475,23 +2464,6 @@ fn to_ttag_union_report<'a>(
|
||||
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([
|
||||
alloc.reflow(r"I am partway through parsing a tag union type, but I got stuck here:"),
|
||||
|
Loading…
Reference in New Issue
Block a user