Skip to content

Feature: Recognize list is too short (less than required parameters) for unpacked-list parameter input #2467

@FlorianLindinger

Description

@FlorianLindinger

Describe the Bug

Would be nice if pyrefly recognizes that a code is guaranteed to crash because an unpacked list has too few elements to satisty the amout of need parameters. (It does not matter if the list is empty. It does not recognize any case where there are too few elements):

def fun1(a):
    return

def fun2():
    fun1(*[])  # no error by pyrefly
    
fun2() # obviously crashes: TypeError: fun1() missing 1 required positional argument: 'a'

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABGAK7oCMAFKgJSIA66NfNAJxgAXegPQ8eVWg3QAmFpx786jVgCoA2gF12fAMQ10uGjAEDcAmtlI0yQsFFLL%2BPWQr2Hc2AG4Rc9HBONADGAqhwABbwiDQAKqTEMACi5paxsqx6ALYQcHAQ6ADmNEyCMACO9BBCmHa4BcL%2B6KhQNKgCRfTZMOjCsQDkqAMgADQg9E1QcCTkiCCGAKpTEMK2siFNuOhwkljUdJbZqMIA%2Bujd2GYs%2BLGFwnoAtAB8NHDCAty8-EKi4nRcEAAOUuZliwHwAF9ATwxiB7NQnIRhLhslAKIYAAqkBzBNBYPD4ULbSBdcJbdCEHiGADKMBgNEiwmExDgiAA9OyEY5SIRLEV2b12ZhcCE4OyQiSIGSTs12YcrKgfKhoKhsLBiehSWJZdsaLhiBSZjwyMJIttHj4zAU9QBeGiAgDMhCYchh6BAkPGqE2ECtADFoDAKPicARZp6gA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Labels

needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.typechecking

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions