Skip to content

Commit ec2cbae

Browse files
committed
Closes #270
1 parent 779b040 commit ec2cbae

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ We follow Semantic Versions since the `0.1.0` release.
1717
- Fixes that types referenced in multiple typeclasses
1818
were not handling `Supports` properly #249
1919
- Fixes typing bug with `ABC` and mutable typeclass signature #259
20+
- Fixes that `mypy` plugin was failing
21+
on calling a typeclass without arguments #270
2022

2123

2224
## Version 0.3.0

classes/contrib/mypy/features/typeclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def call_signature(ctx: MethodSigContext) -> CallableType:
272272
assert isinstance(ctx.type, Instance)
273273

274274
real_signature = ctx.type.args[1]
275-
if not isinstance(real_signature, CallableType):
275+
if not isinstance(real_signature, CallableType) or not ctx.args[0]:
276276
return ctx.default_signature
277277

278278
passed_type = ctx.api.expr_checker.accept(ctx.args[0][0]) # type: ignore

typesafety/test_typeclass/test__call__.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,15 @@
227227
some(ac) # ok
228228
some(bc) # ok
229229
some(abc) # ok
230+
231+
232+
- case: typeclass_call_zero_args_regression270
233+
disable_cache: false
234+
main: |
235+
from classes import typeclass
236+
237+
@typeclass
238+
def some(instance) -> int:
239+
...
240+
241+
some() # E: Missing positional argument "instance" in call to "__call__" of "_TypeClass"

0 commit comments

Comments
 (0)