Skip to content

Commit ae84006

Browse files
committed
Applying review comments #1
1 parent 568b092 commit ae84006

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

‎numba/tests/test_extending.py‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,6 @@ def __init__(self, instance_type):
512512

513513
def get_call_type(self, context, args, kws):
514514

515-
# >>> self == callable_type_ref[<class '__main__.MyClass'>]
516-
# type(self) == <class '__main__.CallableTypeRef'>
517515
res_sig = None
518516
for template in context._functions[type(self)]:
519517
try:
@@ -539,25 +537,20 @@ def get_impl_key(self, sig):
539537

540538
@register_model(CallableTypeRef)
541539
class CallableTypeModel(models.OpaqueModel):
540+
542541
def __init__(self, dmm, fe_type):
543542

544543
models.OpaqueModel.__init__(self, dmm, fe_type)
545544

546545

547-
@typeof_impl.register(CallableTypeRef)
548-
def typeof_callable_typeref(val, c):
549-
return val
546+
infer_global(MyClass, CallableTypeRef(MyClass))
550547

551548

552549
@lower_constant(CallableTypeRef)
553550
def constant_callable_typeref(context, builder, ty, pyval):
554551
return context.get_dummy_value()
555552

556553

557-
def get_callable_typeref(instance_type):
558-
return CallableTypeRef(instance_type)
559-
560-
561554
# -----------------------------------------------------------------------
562555

563556

@@ -1230,17 +1223,15 @@ def impl(x):
12301223

12311224
@overload(CallableTypeRef)
12321225
def callable_type_call_ovld2(x):
1233-
if isinstance(x, (types.UnicodeType, types.StringLiteral)):
1226+
if isinstance(x, types.UnicodeType):
12341227
def impl(x):
12351228
return '42.5' + x
12361229

12371230
return impl
12381231

1239-
typeref_type = get_callable_typeref(MyClass)
1240-
12411232
@njit
12421233
def foo(a, b):
1243-
return typeref_type(a), typeref_type(b)
1234+
return MyClass(a), MyClass(b)
12441235

12451236
args = (4, '4')
12461237
expected = (42.5 + args[0], '42.5' + args[1])

0 commit comments

Comments
 (0)