forked from M-Labs/artiq
compiler: Fix #1871 (array() breaks math functions)
GitHub: Fixes #1871.
This commit is contained in:
parent
2cb08814e8
commit
6b5c390d48
@ -174,7 +174,9 @@ def fn_list():
|
|||||||
return types.TConstructor(TList())
|
return types.TConstructor(TList())
|
||||||
|
|
||||||
def fn_array():
|
def fn_array():
|
||||||
return types.TConstructor(TArray())
|
# numpy.array() is actually a "magic" macro that is expanded in-place, but
|
||||||
|
# just as for builtin functions, we do not want to quote it, etc.
|
||||||
|
return types.TBuiltinFunction("array")
|
||||||
|
|
||||||
def fn_Exception():
|
def fn_Exception():
|
||||||
return types.TExceptionConstructor(TException("Exception"))
|
return types.TExceptionConstructor(TException("Exception"))
|
||||||
|
@ -538,3 +538,19 @@ class _Alignment(EnvExperiment):
|
|||||||
class AlignmentTest(ExperimentCase):
|
class AlignmentTest(ExperimentCase):
|
||||||
def test_tuple(self):
|
def test_tuple(self):
|
||||||
self.create(_Alignment).run()
|
self.create(_Alignment).run()
|
||||||
|
|
||||||
|
|
||||||
|
class _NumpyQuoting(EnvExperiment):
|
||||||
|
def build(self):
|
||||||
|
self.setattr_device("core")
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def run(self):
|
||||||
|
a = np.array([10, 20])
|
||||||
|
b = np.sqrt(4.0)
|
||||||
|
|
||||||
|
|
||||||
|
class NumpyQuotingTest(ExperimentCase):
|
||||||
|
def test_issue_1871(self):
|
||||||
|
"""Ensure numpy.array() does not break NumPy math functions"""
|
||||||
|
self.create(_NumpyQuoting).run()
|
||||||
|
Loading…
Reference in New Issue
Block a user