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
{{ message }}
Repository navigation
Unfinished Variable::Quantified: T in factory-boy's LazyAttribute #4547
I have code like this, using django and factory-boy. The specific django model has two FKs, which both have the identical attr. In the example below that obviously complains about SomeModel not existing as well, but in my real world case those imports are fine.
import factory.django
class SomeFactory(factory.django.DjangoModelFactory[SomeModel]):
attr_match = factory.LazyAttribute(
lambda obj: (
obj.fk_1.attr == obj.fk_2.attr
if obj.fk_1 is not None and obj.fk_2 is not None
else False
)
)
class Meta:
model = SomeModel
When I run pyrefly check on 1.2.0, I get the following error:
ERROR Unfinished Variable::Quantified: T [internal-error]
--> src/min_rep.py:7:32
|
7 | if obj.fk_1 is not None and obj.fk_2 is not None
| ^^^^
|
Sorry, Pyrefly encountered an internal error, this is always a bug in Pyrefly itself
Please report the bug at https://github.com/facebook/pyrefly/issues/new
Sandbox Link
Sandbox doesn't have factory-boy installed
(Only applicable for extension issues) IDE Information
This issue has someone assigned, but has not had recent activity for more than 2 weeks.
If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.
This is fixed. Here's a self-contained repro that errors at pyrefly 1.4.1 and not in the sandbox:
from typing import Any, Callable, Generic, TypeVar
T = TypeVar("T")
V = TypeVar("V")
class Resolver(Generic[T]):
def __getattr__(self, name: str) -> Any: ...
class LazyAttribute(Generic[T, V]):
def __init__(self, function: Callable[[Resolver[T]], V]) -> None: ...
x = LazyAttribute(
lambda obj: (
obj.fk_1.attr == obj.fk_2.attr
if obj.fk_1 is not None and obj.fk_2 is not None
else False
)
)
Activity
github-actions commentedon Aug 29, 2026
This issue has someone assigned, but has not had recent activity for more than 2 weeks.
If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.
Thank you for your contributions!
rchen152 commentedon Nov 6, 2026
This is fixed. Here's a self-contained repro that errors at pyrefly 1.4.1 and not in the sandbox: