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
When using SQLAlchemy 2.0-style ORM models with Mapped[...] = mapped_column(...), Pyrefly incorrectly infers that class-level attributes (e.g., ContactRecord.organization) are being passed to functions as values, even inside instance methods.
Expected behavior:
When referencing self.organization, Pyrefly should recognize this as the instance value (str), not the InstrumentedAttribute[str].
Actual behavior:
Pyrefly emits an error such as: Argument InstrumentedAttribute[str]is not assignable to parameterorganizationwith typestr``
…even when self.organization is correctly used within an instance method.
Describe the Bug
When using SQLAlchemy 2.0-style ORM models with Mapped[...] = mapped_column(...), Pyrefly incorrectly infers that class-level attributes (e.g., ContactRecord.organization) are being passed to functions as values, even inside instance methods.
Expected behavior:
When referencing self.organization, Pyrefly should recognize this as the instance value (str), not the InstrumentedAttribute[str].
Actual behavior:
Pyrefly emits an error such as:
ArgumentInstrumentedAttribute[str]is not assignable to parameterorganizationwith typestr``…even when self.organization is correctly used within an instance method.
Sandbox Link
https://pyrefly.org/sandbox/?code=GYJw9gtgBAJghgFzgYwDZwM4YKYagSwgAcwQFZEV0sAoUSKBATyPwDsBzA408geSIJ8YNnFR1w0DAEd0qZAAtsEJtxJkoASTYJsHbCAA0UAMoIQ7DhIYy5i5UwB0paIXXkAItjRwQifABu2ABCmNjGALJwRETYMMYQ0bEwAPrIYKgArhBsNDQ+WFChOAAUXj5+QkHF2ACUAFw0UM1QKSns+AhtUAC8UAByIth5NAAC8EgFGPnUeADCIpMIjS0EMPUEOk0tynD4qBsCQiJiANoY5gC6282kHHBs+ABe-iIbFyB5U1ALOigIACVvKQYCUag0bq0UkgAEaobCiCDYbp9ABE6T+yAQGFReVW+HWUCiMTip3YCEuvSgiRJqXSWRyJW0un0RigRAsiRATBSAGtsEwegAVECZcJQOCZBBgdjIEDKBEIYWiuqQ3b7DbE5KnI7CUSoc5XSl9GnJNIZbJsEpmCycEoAJgArI7asY2JlUOg4dhlWLapC7g9nq82JqkqSPsbqeG6RbGTbLCUAIwABhTrqg7s9cG9PQAYmIcP7ITBsMBGGAUjBIHsrThUMBalAALQAPh+i3+K1WLXlCEyIDYHcxCBKkJ7LQJPXrwEcBMM44nUHVqGn2AbjhXC6XPcDjxexzYa43e+Dh+MUAAxFAADzN5tQAAKTHlwFQqjfcA4eAQCnweFQdhsE2dIQHlLF30XZpi1WUYpiRX8wBgEsyygegICrGt2BKNAMGMDElg2X4libNsoFRYj-iBUCYFRbsJz7Ach1wscd3xGAegI-453iKCexXTjOyxTdEn2bc2NuEB7n3ENBJHZwpKDA89XEidaiAA
(Only applicable for extension issues) IDE Information
Version: 0.18.1