Skip to content

Commit

Permalink
WPI
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed May 20, 2023
1 parent f605d06 commit e0174cf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/stc_ts_file_analyzer/src/analyzer/assign/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ impl Analyzer<'_, '_> {
r_params,
AssignOpts {
is_params_of_method_definition: false,
disallow_rest_pat_in_left: true,
..opts
},
)
Expand Down Expand Up @@ -836,6 +837,12 @@ impl Analyzer<'_, '_> {
let _tracing = dev_span!("assign_params");

let span = opts.span;
let disallow_rest_in_lhs = opts.disallow_rest_pat_in_left;

let opts = AssignOpts {
disallow_rest_pat_in_left: false,
..opts
};

let mut li = l.iter().filter(|p| {
!matches!(
Expand Down Expand Up @@ -937,11 +944,12 @@ impl Analyzer<'_, '_> {
}

(RPat::Rest(..), _) => {
if opts.disallow_rest_pat_in_left {
if disallow_rest_in_lhs {
dbg!();
print_backtrace();
// TODO(kdy1): Implement correct logic
return Err(ErrorKind::SimpleAssignFailed { span, cause: None }.context("l is rest but r is not"));
}
dbg!();

return Ok(());
}
Expand Down Expand Up @@ -994,8 +1002,6 @@ impl Analyzer<'_, '_> {
},
)?;

print_backtrace();

dbg!(self.assign_param_type(data, &le, &re, opts).with_context(|| {
format!(
"tried to assign a rest parameter to parameters; r_ty = {}",
Expand Down

0 comments on commit e0174cf

Please sign in to comment.