Commit Graph

90 Commits (740815f2b82d362cfe5c09254261951a482e5fdf)

Author SHA1 Message Date
Ibrahim Numanagić 740815f2b8 Track statement times to properly reference names in case of delayed typechecking; Static short-circuiting; Tiered delayed generic resolution 2025-01-18 21:30:37 -08:00
Ibrahim Numanagić 04913cd405 Fix NTuple handling 2024-12-12 19:13:54 -08:00
Ibrahim Numanagić 2cff95109d ScopingVisitor new error handling 2024-12-08 12:20:55 -08:00
Ibrahim Numanagić ecaa8d906e New f-strings (fix #304; fix #359); Better (but slower) capture-aware function type instantiation 2024-12-03 12:23:44 -08:00
Ibrahim Numanagić 48c848cf52 Fix #250 (raise ... from) 2024-11-26 10:47:57 -08:00
Ibrahim Numanagić 0dee70c175 Add TypeWrap to support passing instantiated types 2024-11-08 10:50:44 -08:00
Ibrahim Numanagić ccd26997d7 Refactor wrapExpr (make it pure) 2024-10-21 13:50:36 -07:00
Ibrahim Numanagić efbc26a3b5 Fix variardic tuples 2024-09-07 11:31:01 -07:00
Ibrahim Numanagić 6e4c639e3f Merge branch 'develop' into typecheck-v2 2024-09-03 17:38:17 -07:00
Ibrahim Numanagić 5a484ea76e Fix auto-deduce classes 2024-09-02 18:16:07 -07:00
Ibrahim Numanagić 128ec5229c Refactor field access (getters/setters); Remove direct access to cache; Use raw pointers for types 2024-08-31 11:49:42 -07:00
Ibrahim Numanagić 3ce5295f45 Refactor CallExpr routing 2024-08-14 18:56:02 -07:00
Ibrahim Numanagić b3bfdc8655 Refactor CallExpr routing [wip] 2024-08-14 09:32:03 -07:00
Ibrahim Numanagić 94b623d174 Refactor CallExpr routing [wip] 2024-08-12 08:00:17 -07:00
Ibrahim Numanagić ac309a6900 Refactor CallExpr routing [wip] 2024-08-10 13:51:52 -07:00
Ibrahim Numanagić 2928713a7c Refactor CallExpr routing [wip] 2024-08-09 21:47:42 -07:00
Ibrahim Numanagić 843644f04f Merge branch 'develop' into typecheck-v2 2024-05-03 21:09:08 -07:00
Ibrahim Numanagić f73e974a3d Remove default inits; various bugfixes 2024-04-21 14:05:06 -07:00
Ibrahim Numanagić 547c744b53 Fix infer [wip] 2024-03-28 14:56:25 -07:00
Ibrahim Numanagić 03cbed7c31 Fix constructor passing 2024-03-22 06:47:27 -07:00
Ibrahim Numanagić 127bca6cf3 Fix methodcaller 2024-03-21 15:39:30 -07:00
Ibrahim Numanagić e737536b38 Fix polymorphism 2024-03-18 16:15:36 -07:00
Ibrahim Numanagić df94b9061c Remove RecordType 2024-03-09 18:18:10 -08:00
Ibrahim Numanagić d02775dec0 Fix statics [wip] 2024-03-08 16:51:18 -08:00
Ibrahim Numanagić c16dfb5654
Fix sub-imports (#538)
* Fix sub-imports

* Fix sub-imports

* Remove log lines

---------

Co-authored-by: A. R. Shajii <ars@ars.me>
2024-02-07 10:36:07 -05:00
Ibrahim Numanagić 9a1c2741ee Fix imports and Python [wip] 2024-01-17 21:33:13 -08:00
A. R. Shajii d23c8c7a75
Support "key" argument on min() and max() builtins (#505)
* Support "key" argument on min() and max() builtins

* Delay overload selection when arguments are not known (delayed dispatch)

* Delay 'is None' for 'Optional[T]' until type is known

* Fix union overload selection

* Add static string slicing

* Fix itertools.accumulate

* Fix list comprehension optimization ( minitech:imports-in-list-comprehensions )

* Fix match or patterns

* Fix tests and faulty static tuple issue

* Fix OpenMP reductions with new min/max functions

* Fix domination of dominated bindings; Fix hasattr overloads; Fix arg=None handling

* Fix empty return handling; Mark generators with an attribute

* Fix #487

* Fix test

* Fix IR pass

---------

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2024-01-12 19:27:29 -05:00
Ibrahim Numanagić 10503d3c2a Fix loops 2024-01-09 12:31:45 -08:00
Ibrahim Numanagić cdc8e17955 Fix static issues 2024-01-08 23:09:29 -08:00
A. R. Shajii d609629489
Format 1-element tuples as "(x,)" (#521)
* Format 1-element tuples as "(x,)"

Currently, single-element tuple "repr" / "str" gives "(x)", but it should really give "(x,)" according to Python.

* Fix tests
2024-01-02 13:35:55 -05:00
Ibrahim Numanagić 416cc5fa59
Bugfixes (Dec 2023) (#515)
* Delay overload selection when arguments are not known (delayed dispatch)

* Delay 'is None' for 'Optional[T]' until type is known

* Fix union overload selection

* Add static string slicing

* Fix itertools.accumulate

* Fix list comprehension optimization ( minitech:imports-in-list-comprehensions )

* Fix match or patterns

* Fix tests and faulty static tuple issue
2023-12-26 09:35:03 -05:00
Ibrahim Numanagić cff38ea734 Fix cond tests [wip] 2023-12-13 17:23:50 -08:00
Ibrahim Numanagić bef36e016a Fix call tests [wip] 2023-12-09 18:13:07 -08:00
A. R. Shajii b4a3f890ff
Property setters (#501)
* Fix __from_gpu_new__

* Fix GPU tests

* Update GPU debug codegen

* Add will-return attribute for GPU compilation

* Fix isinstance on unresolved types

* Fix union type instantiation and pendingRealizations placement

* Add float16, bfloat16 and float128 IR types

* Add float16, bfloat16 and float128 types

* Mark complex64 as no-python

* Fix float methods

* Add float tests

* Disable some float tests

* Fix bitset in reaching definitions analysis

* Fix static bool unification

* Add property setters

* Remove log

* Add Union hasattr support

* Fix union bugs; Move union logic to internal.codon; Add fn_can_call for any expression

* Fix isinstance(x, Union)

---------

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-12-04 11:14:08 -05:00
A. R. Shajii 78a3d7d982
Union hasattr (#500)
* Fix __from_gpu_new__

* Fix GPU tests

* Update GPU debug codegen

* Add will-return attribute for GPU compilation

* Fix isinstance on unresolved types

* Fix union type instantiation and pendingRealizations placement

* Add float16, bfloat16 and float128 IR types

* Add float16, bfloat16 and float128 types

* Mark complex64 as no-python

* Fix float methods

* Add float tests

* Disable some float tests

* Fix bitset in reaching definitions analysis

* Fix static bool unification

* Add property setters

* Remove log

* Add Union hasattr support

---------

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-11-27 12:24:21 -05:00
A. R. Shajii 7fdbc7f21e
Property setters (#499)
* Fix __from_gpu_new__

* Fix GPU tests

* Update GPU debug codegen

* Add will-return attribute for GPU compilation

* Fix isinstance on unresolved types

* Fix union type instantiation and pendingRealizations placement

* Add float16, bfloat16 and float128 IR types

* Add float16, bfloat16 and float128 types

* Mark complex64 as no-python

* Fix float methods

* Add float tests

* Disable some float tests

* Fix bitset in reaching definitions analysis

* Fix static bool unification

* Add property setters

* Remove log

---------

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-11-22 10:43:25 -05:00
A. R. Shajii 1e6382c564
Fix domination within deeply nested blocks (#485)
Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-10-03 17:04:15 -04:00
Ibrahim Numanagić ce459c5667
New Tuple machinery (#462)
* Refactor Tuple class

* Add Tuple[N,...] support; Fix inline operators with list brackets

* Fix Tuple[N,...] support

* Merge Sequre SIMD changes

* Fix repeat-tuple unification

* Fix staticlen in OpenMP

* Fix isinstance unification

* Fix delayed unification with static realization

* Fix CI

* Cleanup

* Use "fcmp une" in float.__ne__()

---------

Co-authored-by: A. R. Shajii <ars@ars.me>
2023-09-26 10:49:14 -04:00
Ibrahim Numanagić 502eed22f4 Add missing tests 2023-09-22 10:11:00 -07:00
Ibrahim Numanagić 9e6a4e5515 Fix access tests 2023-09-22 10:10:24 -07:00
Ibrahim Numanagić 750bb28c9c
Bugfixes 2023-08 (#440)
* Fix type argument overload issue; Fix Cython version for CI

* Add __contains__ for kwargs

* Add get() for kwargs

* Add static <<, >> and unary ~

* Fix CI

* Fix OpenMP "ordered" clause

* Fix static ~

* Fix Cython 3 issues

* Fix Python MANIFEST.in

---------

Co-authored-by: A. R. Shajii <ars@ars.me>
2023-08-12 10:39:45 -04:00
Ibrahim Numanagić c6faa0ecfa Fix tests 2023-08-09 12:40:27 +02:00
Ibrahim Numanagić ef743a6227 Fix try-catch scoping 2023-08-08 22:58:08 +02:00
Ibrahim Numanagić c951f2906a Merge simplify & typecheck (basic tests passd) 2023-08-06 22:50:49 +02:00
Ibrahim Numanagić 7c345a8f39 Merge simplify & typecheck: new name parser [wip] 2023-07-15 23:55:07 +02:00
Ibrahim Numanagić 47a2745f06
Better Jupyter support & Polymorphism improvements (#363)
* Remove vtables from objects (use __id__ only); Add static itemgetter

* Migrate to XEUS 3

* Fix XEUS patches

* Fix docs [skip ci]

* Use tuples for RTTI classes

* clang-format

* Add polymorphic to IR RefType

* Pass isPolymorphic to IR

* Update codegen for new poly ref types

* New RTTI memory layout; Fix #346

* Ellipsis class; handle ellipses

* Move all generated magics to Codon (__magic__)

* Fix vars_types

* Update polymorphic setter

* Fix compiler warnings

* Fix pyext assert

* Update ellipsis

* Update pure/derives tags

* Update dataclass order magics

* Add pure/derives tags

* Fix partial printing

* Add extra tuple test

---------

Co-authored-by: A. R. Shajii <ars@ars.me>
2023-05-10 09:28:25 -04:00
Ibrahim Numanagić 8dd71aa1a4 Ellipsis class; handle ellipses 2023-05-01 16:18:18 -07:00
Ibrahim Numanagić 28b3b00b64 New RTTI memory layout; Fix #346 2023-05-01 15:34:06 -07:00
Ibrahim Numanagić 710a38539f Remove vtables from objects (use __id__ only); Add static itemgetter 2023-04-17 12:11:41 -07:00
A. R. Shajii 5613c1a84b
v0.16 (#335)
* Add Python extension lowering pass

* Add DocstringAttribute

* Add extension module codegen

* Handle different argument counts efficiently

* Add warnings to extension lowering

* Fix module name

* Fix extension codegen

* Fix argument check

* Auto-convert Codon exceptions to Python exceptions

* Fix #183

* Fix #162; Fix #135

* Fix #155

* Fix CPython interface in codegen

* Fix #191

* Fix #187

* Fix #189

* Generate object file in pyext mode

* Convert Codon exceptions to Python exceptions

* Fix vtable init; Fix failing tests on Linux

* Fix #190

* Fix #156

* Fix union routing

* Remove need for import python

* Automatic @export and wrapping for toplevel functions

* Reorganize API

* Add Python extension IR structs

* Add special calls for no-suspend yield-expr

* Add special calls for no-suspend yield-expr

* pyextension.h support [wip]

* pyextension.h support [wip]

* pyextension.h support

* pyextension.h support for toplevel functions

* clang-format

* Add PyFunction::nargs field

* Update pyextension codegen (WIP)

* SUpport nargs

* Add support for @pycapture

* PyType codegen (WIP)

* Py method codegen (WIP)

* Add type ptr hook

* Add getset codegen

* Add type alloc function

* Add type pointer hook codegen

* Re-organize codegen

* Add member codegen

* Update module init codegen

* Update module init codegen

* Add support for typePtrHook and new to/from_py hooks

* Fix extension codegen

* Fix init codegen

* Fix init codegen; add "tp_new" slot

* Fix type hook

* Add extra flags

* Specialized wrappers (PyType specs)

* Add static Python link option

* Fix C imports

* Add guards

* Remove unused field

* Python mode only when pyExt set

* Update python module

* Fix assert

* Update codegen/passes

* Fix tuple parsing in index expression

* Fix empty tuple unification

* Do not Cythonize underscore fns

* clang-format

* Fix switch

* Add Py support for cmp/setitem

* Add Py support for cmp/setitem

* Add type is support

* GetSet support

* clang-format

* GetSet support (fixes)

* Avoid useless vtable alloc

* Add iter support

* Fix size_t capture bug

* clang-format

* Fix POD type unification with tuples

* Add __try_from_py__ API

* Fix annotation

* Add static reflection methods (setattr; internal.static.*); refactor PyExt to python.codon; handle errors and kwargs in PyExt

* Python compat fixes

* Update Python object conversions

* Fix PyErrors

* clang-format; add copyright

* Add PyFunction::keywords field

* Fix JIT MRO handling; Refactor out Jupyter support

* Refactor out Jupyter support

* Add support for custom linking args (link=[]) to TOML plugins

* Fix tests

* Use g++ instead of gcc

* Fix Jupyter CMAKE

* Fix Jupyter CMAKE

* Add _PyArg_Parser definition

* Add complex64 type

* Add extra complex64 tests

* Fix Python calls; add staticenumerate

* Fix call

* Fix calls

* Update pyext wrappers

* Fix staticenumerate; Support static calls in tuple()

* Fix pyext routing

* Add add/mul for tuples

* clang-format

* Fix pyext codegen

* Fix wrap_multiple

* Add seq_alloc_atomic_uncollectable

* Fix default generics issue

* Add binary/ternary ops

* Fix missing generic issue

* Fix number slots

* Update pow

* Remove unnecessary pyobj

* Fix allocation

* Refactor errors

* Add test extension

* Fix formatting

* clang-format

* Fix getitem/setitem/delitem in pyext

* Fix pyext iterators

* Add builtin pow() (fix #294)

* Fix #244

* Fix #231

* Fix #229

* Fix #205

* Update docs

* Fix error message

* Add pyext tests

* Add pyext support for @property

* Add pyext support for toplevel fns and @tuple classes

* More pyext tests

* More pyext tests

* Fix file error checking

* More pyext tests

* Update pyext tests

* Update docs

* Add pyext test to CI

* Add pyext support for @tuple.__new__

* Add pyext support for @tuple.__new__

* Fix hetero-tuple issue with fn_overloads

* More pyext tests

* Bump versions

* Fix del magic in pyext

* Fix init magic for tuples in pyext

* Have test-pypi only run on develop branch

* Make exception type indices unnamed-addr

* Fix #316; Fix #317 (slash issue)

* Use uncollectible-alloc for vtable

* Fix #249

* Add pyext docs

* Fix #249; Fix clashing vtables; Fix super() and class_copy

* Add content-atomic type property instruction

* __contents_atomic__ support

* Update internal functions

* Use PIC when generating Python extension

* Cleanup

* Add Dockerfile & fix -fPIC

* Cleanup

* Fix setup.py

* Fix pyext fn iteration

* Fix CI

* clang-format

* Update long conversions in Py bridge

* Support wide-int to str conversions

* Fix test

* Add pow for arbitrary-width ints

* Fix Linux backtraces

* Cleanup

* Add more tests

* Fix docs; Remove tuple.__add__ for scalars

* Update docs

---------

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-04-12 18:13:54 -04:00