Preserve source identity ownership across prepared model commands
This commit is contained in:
@@ -191,6 +191,40 @@ fn cross_file_typed_ports_global_forward_references_and_stable_ids() {
|
||||
assert_eq!(warning.diagnostic.line, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn advisory_lint_locations_refer_to_raw_drafts_before_identity_stabilization() {
|
||||
let input = bundle(
|
||||
"arcadia 3; project p \"P\" { include \"work.arcadia\"; }",
|
||||
&[(
|
||||
"work.arcadia",
|
||||
"sa_function first \"First\" {}\nsa_function second \"Second\" {}\n",
|
||||
)],
|
||||
);
|
||||
let before = input.clone();
|
||||
let raw = &input.files["work.arcadia"];
|
||||
let warnings = lint_bundle(&input, ProjectLimits::default());
|
||||
let second = warnings
|
||||
.iter()
|
||||
.find(|d| {
|
||||
d.path == "work.arcadia"
|
||||
&& d.diagnostic.code == "unallocated_leaf"
|
||||
&& d.diagnostic.line == 2
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
second.diagnostic.span.start,
|
||||
raw.find("sa_function second").unwrap()
|
||||
);
|
||||
assert!(raw[second.diagnostic.span.start..second.diagnostic.span.end].contains("second"));
|
||||
assert_eq!(input, before);
|
||||
let compiled = compile(&input);
|
||||
assert_ne!(compiled.bundle, input);
|
||||
assert!(compiled.diagnostics.iter().any(|d| d.path == "work.arcadia"
|
||||
&& d.diagnostic.code == "unallocated_leaf"
|
||||
&& d.diagnostic.line == 2
|
||||
&& d.diagnostic.span.start > second.diagnostic.span.start));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_errors_keep_exact_fragment_unicode_positions() {
|
||||
let input = bundle(
|
||||
|
||||
Reference in New Issue
Block a user