Commit Graph

6 Commits

Author SHA1 Message Date
Rajveer
c34f099c7d Improved out-of-place binding diagnostic and reflecting 'var' or 'let' binding pattern
Fixes Issue #63993
2023-03-19 19:26:58 +05:30
Hamish Knight
043b192dcd [Sema] Diagnose duplicate pattern vars in pattern resolution
Unify the duplicate pattern var checking in
pattern resolution such that it is always called
no matter how we end up type-checking the pattern.
This avoids incorrectly allowing duplicate pattern
vars to compile for patterns as a part of
multi-statement closures.
2023-03-01 16:20:14 +00:00
Slava Pestov
5808d9beb9 Parse: Remove parse-time name lookup 2020-11-16 22:39:44 -05:00
Slava Pestov
6a5684a76c Sema: Allow duplicate internal parameter names on protocol requirements
This fixes a recent source compatibility regression.

Fixes <rdar://problem/70445751>.
2020-10-19 16:02:14 -04:00
Slava Pestov
6042784578 Sema: Tweak re-declaration checking behavior to match old logic
The parser's own re-declaration checking for local declarations has
slightly different behavior than Sema's re-declaration check.

Whereas Sema rejects this:

class C {
  let x = 123
  func x() {}
}

The parser accepts this:

func f() {
  let x = 123
  func x() {}
}

With Sema's check now handling both cases, fudge the behavior to
match the parser in the local case.
2020-10-01 23:46:26 -04:00
Slava Pestov
18f5f94ce2 Sema: Check for duplicate parameter and generic parameter names when parser lookup is off
The existing redeclaration checking can be extended for declarations in
local scope, but it won't catch these.
2020-09-29 23:38:24 -04:00