ItemTree: Lower fields despite invalid type
This commit is contained in:
parent
ad1a0e626b
commit
4ef1d533bd
2 changed files with 25 additions and 1 deletions
|
@ -211,7 +211,7 @@ impl Ctx {
|
||||||
fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> {
|
fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> {
|
||||||
let name = field.name()?.as_name();
|
let name = field.name()?.as_name();
|
||||||
let visibility = self.lower_visibility(field);
|
let visibility = self.lower_visibility(field);
|
||||||
let type_ref = self.lower_type_ref(&field.ascribed_type()?);
|
let type_ref = self.lower_type_ref_opt(field.ascribed_type());
|
||||||
let res = Field { name, type_ref, visibility };
|
let res = Field { name, type_ref, visibility };
|
||||||
Some(res)
|
Some(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,6 +507,30 @@ fn no_such_field_with_feature_flag_diagnostics_on_struct_fields() {
|
||||||
assert_snapshot!(diagnostics, @r###""###);
|
assert_snapshot!(diagnostics, @r###""###);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_such_field_with_type_macro() {
|
||||||
|
let diagnostics = TestDB::with_files(
|
||||||
|
r"
|
||||||
|
macro_rules! Type {
|
||||||
|
() => { u32 };
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo {
|
||||||
|
bar: Type![],
|
||||||
|
}
|
||||||
|
impl Foo {
|
||||||
|
fn new() -> Self {
|
||||||
|
Foo { bar: 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.diagnostics()
|
||||||
|
.0;
|
||||||
|
|
||||||
|
assert_snapshot!(diagnostics, @r###""###);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn missing_record_pat_field_diagnostic() {
|
fn missing_record_pat_field_diagnostic() {
|
||||||
let diagnostics = TestDB::with_files(
|
let diagnostics = TestDB::with_files(
|
||||||
|
|
Loading…
Add table
Reference in a new issue