89 Commits
Author SHA1 Message Date
93c6e39251 Fix #844 alternative 2: do not allow access to unexported struct fields (#846)
* add regression test

* fix #844: disallow direct access to unexported struct fields

---------

Co-authored-by: Anton Medvedev <[email protected]>
2025-09-21 20:58:24 +02:00
Diego Augusto MolinaandGitHub faf4cc4359 Issue 840: Fix get field pointer struct (#843)
* improve issue test

* fix #840: pointer to struct env not returning fields
2025-09-21 20:42:57 +02:00
Anton Medvedev 64df7b63f7 Add more tests 2025-09-18 21:39:22 +02:00
2pacandGitHub 9e10dcd6b4 fix(785): get to work when return is nil (#786)
* fix(785): `get` to work when return is `nil`

* improve testing
2025-05-12 18:32:48 +02:00
Anton MedvedevandGitHub 452d355706 Make expr.Eval faster (#775)
* Make expr.Eval faster

* Add bench_call_test.go

* Make parser config optional
2025-03-24 14:48:41 +01:00
Anton Medvedev 85fa77e98b Refactor examples tests 2025-03-24 12:01:07 +01:00
Anton Medvedev 564822e8f3 Add examples testing 2025-03-21 18:09:09 +01:00
Anton Medvedev 69512cb435 gen: fix 2025-03-19 12:32:26 +01:00
Anton Medvedev d179a6e5c5 gen: fix predicate generator 2025-03-19 12:32:03 +01:00
Anton Medvedev 3289edf207 gen: less string vars 2025-03-18 23:57:51 +01:00
Anton Medvedev d79a97301c gen: add $env 2025-03-18 23:54:38 +01:00
Anton Medvedev 22d50fd301 gen: add vars 2025-03-18 23:45:05 +01:00
Anton Medvedev 6a0a8f1ba5 gen: simplify search 2025-03-18 23:38:28 +01:00
Anton Medvedev 1e7796412f gen: use all cpus 2025-03-18 23:20:00 +01:00
Anton Medvedev ab2c230eaf Refactor random code get 2025-03-18 23:08:02 +01:00
Anton Medvedev 8aaa33b16e Test for issue 756
Fixes #756
2025-03-10 15:00:21 +01:00
Anton Medvedev 82ec7571df Correctly add OpDeref if needed
Fixes #739
2025-03-09 13:07:38 +01:00
Anton Medvedev 80eb95bf5f Make sure get() returns nil for map[string]string on missing keys
Fixes #723
2025-03-08 17:28:39 +01:00
Anton Medvedev 6c8437454d Update fuzz tests 2025-03-08 16:19:30 +01:00
Anton Medvedev 7e417b043e Add -update flag to gen tests 2025-03-08 15:40:47 +01:00
Anton Medvedev 8cab964afb Improve type checker for named types 2025-03-08 15:33:37 +01:00
Anton Medvedev 3d52b8e334 Fix func calls with nil types value
Fixes #688
2025-03-08 13:54:55 +01:00
Anton Medvedev 02dc5c04fc Properly check if interface is any
Fixes #744
2025-03-07 22:56:41 +01:00
f99e1bad97 Separate patching phases for patchers that require multiple passes. (#659)
* Reset tracking of applied operator overloads before every walk of the ast tree.

* Remove limit on operator overload resolution

* Do separate patcher phase for those that require multiple passes (Currently only need for Operator overloading). This patcher phase is run after other patchers.

* Add test to track how many times a patcher is run. Used to detect if patching phases is erroneously applying the patcher multiple times.

---------

Co-authored-by: Anton Medvedev <[email protected]>
2025-03-07 15:27:19 +01:00
Nathan BaulchandGitHub 0dd69ea8ca Fix typos (#745) 2025-01-09 13:33:28 +01:00
Simon WaldherrandGitHub 42eec6f21f Fix typos (#686) 2024-07-14 09:07:58 +02:00
Anton MedvedevandGitHub fee5690347 Refactor checker to use Nature (#665)
This PR introduces a new concept inside Expr's type checker - Nature.

It's an abstraction other reflect.Type which carries additional information about possible type, methods and builtin function.

I was able to find and fix a few bugs in type checker and optimizer. Implementation of nature concept has proven itself. As well nature will allow to bring more feature for type checker in future.

Why Nature? I was looking for a name to replace Type. Type name already carries much information, as well can be confused with reflect.Type. Nature name should be understood as "nature of the node", same as "type of the node".
2024-06-01 00:09:22 +02:00
Anton MedvedevandGitHub 0308dbbbb4 Fix function calls with int64 params (#663)
Fixes #661
2024-05-27 12:05:19 +02:00
Ganesan KaruppasamyandGitHub b53d7bdcfd Invoke the Deref function as needed for the function arguments. (#651) 2024-05-21 11:10:48 +02:00
Anton MedvedevandGitHub 68e3148c1f Vendor testify (#642) 2024-05-08 00:24:35 +02:00
Anton Medvedev 27b20607f1 Add sum(map()) optimization 2024-04-13 22:50:11 +02:00
Anton MedvedevandGitHub 772eaba1ca Add predicate to sum() builtin (#592)
* Add predicate to sum() builtin

* go mod tidy
2024-04-13 15:37:02 +02:00
needsureandGitHub c0d4644255 chore: fix some typos in conments (#622)
Signed-off-by: needsure <[email protected]>
2024-04-09 13:13:55 +02:00
Anton Medvedev ee9b3142d1 Add quotes to error message 2024-02-18 09:45:39 +01:00
Anton Medvedev b117e690fb Fix operator overloading recursive
Fixes #548
2024-02-18 00:15:39 +01:00
Anton Medvedev 96c6ad6087 Refactor operator override to be purely patcher pkg 2024-02-17 19:56:28 +01:00
Nikolay MatrosovandGitHub 0ebf2c2574 feat: Operator overload from Function (#408)
* feat: rewritten Operator overload from Function

* fix: add test
2024-02-17 14:33:07 +01:00
Anton Medvedev c86f2e2718 Update real_world example 2024-02-16 23:13:44 +01:00
Anton MedvedevandGitHub 0d43107999 Add concat() builtin (#565)
* Add concat() builtin

* Use pkg deref in builtin

* Use pkg deref in checker

* Use pkg deref in types_table.go

* Use pkg deref in docgen.go

* Use pkg deref in vm
2024-02-16 22:32:35 +01:00
Anton MedvedevandGitHub 8e2df3e45e Simplify ast nodes (#503)
* Move FiendIndex and MethodIndex out of ast nodes

* Remove println statement

* Add method compiler tests
2023-12-26 23:14:20 +01:00
Anton Medvedev 1c71bad386 Add change ident patcher test 2023-12-26 16:24:00 +01:00
Sergey GrebenshchikovandGitHub 3426d4bcce Fix: checker panic on embedded pointer to struct field (#500)
* add failing test case: embedded pointer to struct

* fix(dereference embedded pointers to structs)

* add evaluation test for field access and method call on embedded pointer struct
2023-12-18 21:46:31 +01:00
Anton Medvedev 97df6debcd fix: make deref commutative
Fixes #490
2023-12-10 11:02:12 +01:00
Anton Medvedev ed9dba3991 fuzz: add custom function to fuzzer 2023-12-10 10:44:58 +01:00
Anton Medvedev f03eec706a fuzz: exclude error unknown time zone 2023-12-08 18:42:45 +01:00
Anton Medvedev 551d2a7e0f Use expr-lang/expr 2023-12-03 21:53:01 +01:00
Anton Medvedev 57eb00d735 fuzz: skip string index out of range 2023-11-27 22:03:15 +01:00
Anton Medvedev 18b58750af fuzz: extend "cannot sum" error to all types 2023-11-24 16:54:23 +01:00
Anton Medvedev 885c769c65 Fix type checker for float arguments
Fixes #474
2023-11-24 16:50:09 +01:00
Anton Medvedev e817dfb8a8 fuzz: ignore sun(any) runtime errors
Fixes #464
2023-11-16 22:31:25 +01:00