Skip to content

Commit

Permalink
Fix function params hovering in the LSP (#1395)
Browse files Browse the repository at this point in the history
NLS was always showing no type (`Dyn`) when hovering on the occurrence
of a variable referring to a function parameter inside statically typed
code. The usage was always set to `ValueState::Unknown`, while it's
actually known. This commit restores the correct value state.
  • Loading branch information
yannham committed Jun 22, 2023
1 parent 7938c0b commit 7dabdcc
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions lsp/nls/src/linearization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,12 @@ impl<'a> Linearizer for AnalysisHost<'a> {
index: id_gen.get_and_advance(),
};
self.env.insert(ident.to_owned(), id);
let kind = match term {
Term::LetPattern(..) => TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: value_ptr,
path: None,
},
Term::FunPattern(..) => TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: ValueState::Unknown,
path: None,
},
_ => unreachable!(),

let kind = TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: value_ptr,
path: None,
};
lin.push(LinearizationItem {
env: self.env.clone(),
Expand Down Expand Up @@ -315,20 +307,12 @@ impl<'a> Linearizer for AnalysisHost<'a> {
index: id_gen.get(),
},
);
let kind = match term {
Term::Let(..) => TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: value_ptr,
path: None,
},
Term::Fun(..) => TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: ValueState::Unknown,
path: None,
},
_ => unreachable!(),

let kind = TermKind::Declaration {
id: ident.to_owned(),
usages: Vec::new(),
value: value_ptr,
path: None,
};
lin.push(LinearizationItem {
env: self.env.clone(),
Expand Down

0 comments on commit 7dabdcc

Please sign in to comment.