Summary
Python bytes supports lexicographic comparison (b"abc" < b"abd" is True). Currently only +, *, ==, !=, in are supported in the compiler. The <, <=, >, >= operators are missing from:
OperatorValidator.cs — bytes dunder whitelist
TypeInferenceService.TryInferBuiltinBinaryOp — bytes binary operator inference
Fix
- Add
DunderNames.Lt or DunderNames.Le or DunderNames.Gt or DunderNames.Ge to the bytes case in OperatorValidator.cs
- Add cases returning
SemanticType.Bool for those operators in TypeInferenceService.TryInferBuiltinBinaryOp
Found during architectural review of plan-1523bd.
Summary
Python
bytessupports lexicographic comparison (b"abc" < b"abd"isTrue). Currently only+,*,==,!=,inare supported in the compiler. The<,<=,>,>=operators are missing from:OperatorValidator.cs— bytes dunder whitelistTypeInferenceService.TryInferBuiltinBinaryOp— bytes binary operator inferenceFix
DunderNames.Lt or DunderNames.Le or DunderNames.Gt or DunderNames.Geto the bytes case inOperatorValidator.csSemanticType.Boolfor those operators inTypeInferenceService.TryInferBuiltinBinaryOpFound during architectural review of plan-1523bd.