Commit 27d1dcf0 authored by Mark Florisson's avatar Mark Florisson

Specialized fused indices

parent 23b8ea6d
...@@ -2805,6 +2805,9 @@ class IndexNode(ExprNode): ...@@ -2805,6 +2805,9 @@ class IndexNode(ExprNode):
self.is_fused_index = False self.is_fused_index = False
return return
for i, type in enumerate(specific_types):
specific_types[i] = type.specialize_fused(env)
fused_types = base_type.get_fused_types() fused_types = base_type.get_fused_types()
if len(specific_types) > len(fused_types): if len(specific_types) > len(fused_types):
return error(self.pos, "Too many types specified") return error(self.pos, "Too many types specified")
......
...@@ -57,6 +57,12 @@ class BaseType(object): ...@@ -57,6 +57,12 @@ class BaseType(object):
return None return None
def specialize_fused(self, env):
if env.fused_to_specific:
return self.specialize(env.fused_to_specific)
return self
def _get_fused_types(self): def _get_fused_types(self):
""" """
Add this indirection for the is_fused property to allow overriding Add this indirection for the is_fused property to allow overriding
......
...@@ -282,3 +282,18 @@ def test_cython_numeric(cython.numeric arg): ...@@ -282,3 +282,18 @@ def test_cython_numeric(cython.numeric arg):
double complex (10+1j) double complex (10+1j)
""" """
print cython.typeof(arg), arg print cython.typeof(arg), arg
cdef fused ints_t:
int
long
cdef _test_index_fused_args(cython.floating f, ints_t i):
print cython.typeof(f), cython.typeof(i)
def test_index_fused_args(cython.floating f, ints_t i):
"""
>>> import cython
>>> test_index_fused_args[cython.double, cython.int](2.0, 3)
double int
"""
_test_index_fused_args[cython.floating, ints_t](f, i)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment