You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defsum_matrix(matrix: list[list[int]]) ->int:
"""Sum all values in a 2D matrix."""total: int|None=Noneforrowinmatrix:
total=0forvalinrow:
total+=val# pyrefly FP: `+=` is not supported between `None` and `int`returntotalor0
All other type checkers would narrow total to int in the inner loop, except for Pyrefly.
Describe the Bug
Minimal repro:
All other type checkers would narrow
totaltointin the inner loop, except for Pyrefly.Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABHAK4C2A%2Bo6gC4BOE%2BAFG1x6IaUCHHYBtUeIkR07ALoKAlDQC0APhpz2iADroaRmnpCnTAZSY1UUKDQBut%2BvG2HUNAEwARGgO5E5mZmhsbsuOy2wjo0AD40AHK46DA0ALyJyTAGxjRguJw0nLgA7m5%2BHAH6oblG4ZH2GQAMObVG%2BYVO9nJFpdVtbfW2NADUGV1GAMQ0ZJzUUKTCAAZjS9pwNOgRdPTExAXsMJg02DDsJTAwhktJKWsYx0s6S61Gc%2Bz0nIZD9gU0TSAADQgejsaBwEjkRAgaYAVTBonYpDy9HQAGMwck4AYDFRaB0BMx0ExTpxePhovJVJo6Fx%2BsZ3p9DGBTAkSTBOMJgPgAL7mdBAkCzeakQjhRhQCjTAAKpDmYAWdAeeHwNDRyUgAHNPhwIMlCAZphZLjQABbsdjEOCIAD0NuFCtFBU1NquNswuDRcBt6vQWp1mPQNryf1QTmgqGwsDVGog2s4uuSNFwxEDEIMZHYpuSagcHLgesMGVMAGZCABGTz8kA84GoDEQPMAMWgMAoaCwKshNaAA
(Only applicable for extension issues) IDE Information
No response