forked from M-Labs/artiq
1
0
Fork 0
artiq/artiq
David Nadlinger 5ba22c11c3 compiler: Change type inference rules for empty array() calls
array([...]), the constructor for NumPy arrays, currently has the
status of some weird kind of macro in ARTIQ Python, as it needs
to determine the number of dimensions in the resulting array
type, which is a fixed type parameter on which inference cannot
be performed.

This leads to an ambiguity for empty lists, which could contain
elements of arbitrary type, including other lists (which would
add to the number of dimensions).

Previously, I had chosen to make array([]) to be of completely
indeterminate type for this reason. However, this is different
to how the call behaves in host NumPy, where this is a well-formed
call creating an empty 1D array (or 2D for array([[], []]), etc.).

This commit adds special matching for (recursive lists of) empty
ListT AST nodes to treat them as scalar dimensions, with the
element type still unknown.

This also happens to fix type inference for embedding empty 1D
NumPy arrays from host object attributes, although multi-dimensional
arrays will still require work (see GitHub #1633).

GitHub: Fixes #1626.
2021-03-14 22:48:43 +00:00
..
applets gui: quamash -> qasync 2020-12-12 21:59:25 +08:00
browser artiq_browser: update h5py api call 2020-12-17 14:23:16 +08:00
compiler compiler: Change type inference rules for empty array() calls 2021-03-14 22:48:43 +00:00
coredevice jsonschema: validate hw_dev depending on target 2021-02-12 11:09:01 +08:00
dashboard allow dashboard to close if no connection can be made to moninj 2020-12-04 23:00:23 +08:00
examples metlino_sayma_ttl: Fix RTIO frequency & demo code (#1516) 2020-09-03 15:08:31 +08:00
firmware increase memory allocated to comms CPU 2021-02-21 19:06:12 +08:00
frontend sinara_tester/mirny: remove hw_rev checking fixup code 2021-01-29 18:47:40 +01:00
gateware increase memory allocated to comms CPU 2021-02-21 19:06:12 +08:00
gui update major version 2021-02-17 16:18:05 +08:00
language replaced deprecated inspect.getargspec() with inspect.getfullargspec() 2021-02-28 14:25:05 +08:00
master master: refactor experiments enumeration, use tools.get_experiment 2021-02-13 10:06:12 +08:00
sim ttl: Add target RTIO time argument to timestamp/count functions 2018-11-03 20:33:19 +08:00
test compiler: Change type inference rules for empty array() calls 2021-03-14 22:48:43 +00:00
wavesynth wavesynth: silence is a channel property (closes #348) 2016-04-07 21:51:29 +08:00
__init__.py simplify versioneer 2020-07-30 00:54:07 +08:00
_version.py simplify versioneer 2020-07-30 00:54:07 +08:00
appdirs.py add appdirs 2016-07-18 16:40:18 +02:00
build_soc.py build_soc: remove assertion that was used for test runs 2020-09-03 20:24:18 +08:00
experiment.py artiq.experiment: merge language and coredevice namespaces 2016-01-25 17:24:00 -07:00
remoting.py artiq_flash: added option of specifying another username when connecting through SSH. (#1429) 2020-02-19 19:44:11 +08:00
tools.py get_experiment() is able to get nested experiment classes using dots in class names. 2021-02-28 14:26:44 +08:00