Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't add constraints for invalid subscript declarations. #389
Adding constraints for the invalid operator decl means constraining to the error type, which fails an assertion later on while binding an overload choice. In all the normal function/method overload choice cases, if the decl is invalid that choice gets skipped (never generated), so this is just another case of the existing way of doing things.
Great catch. I'd suggest returning "Type()" when the decl is known invalid (mirroring the behavior in visitOverloadedMemberRefExpr around line 1312). Also, since the test case is small and should be fast to run, please add it to the non-validation test suite, I'd suggest in test/decl/subscript/subscripting.swift.
Thank you for tracking this down and fixing it!