Removing extra private tag references

This commit is contained in:
Ayaz Hafiz 2022-04-25 11:43:55 -04:00
parent cf8409dfaa
commit 2ab01107d3
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58
4 changed files with 4 additions and 48 deletions

View File

@ -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(

View File

@ -223,7 +223,6 @@ pub enum BadIdent {
WeirdDotAccess(Position),
WeirdDotQualified(Position),
StrayDot(Position),
BadPrivateTag(Position),
BadOpaqueRef(Position),
}

View File

@ -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 "),

View File

@ -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:"),