sourcery icon indicating copy to clipboard operation
sourcery copied to clipboard

Type narrowing seems to confuse Sourcery

Open diceroll123 opened this issue 3 years ago • 1 comments

Issue description or question

image

  1. The test2 method is actually the properly typed one, yet Sourcery fails to suggest the same simplification.
  2. The suggested simplification could be simpler in this specific case, as mentioned in the first test method.

Sourcery Version

v0.10.3

Code editor or IDE name and version

VSC Version: 1.64.2 (user setup) Commit: f80445acd5a3dadef24aa209168452a3d97cc326 Date: 2022-02-09T22:02:28.252Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22557

OS name and version

Windows 11

diceroll123 avatar Feb 26 '22 17:02 diceroll123

Good spot and thanks for raising - improving our type inference is definitely on our roadmap!

Hellebore avatar Feb 28 '22 21:02 Hellebore