Commit Graph

15 Commits

Author SHA1 Message Date
Ayke van Laethem 5b42871baa compiler: support all kinds of recursive types
Previously we only supported recursive types in structs. But there can
be other kinds of recursive types, like slices:

    type RecursiveSlice []RecursiveSlice

This doesn't involve structs, so it led to infinite recursion in the
compiler. This fix avoids recursion at the proper level: at the place
where the named type is defined.
2023-03-18 17:53:47 +01:00
Ayke van Laethem 4695da83b7 all: drop support for Go 1.16 and Go 1.17 2022-08-30 12:38:06 +02:00
Dan Kegel 7af24c7864 compiler: allow slices of empty structs.
Fixes https://github.com/tinygo-org/tinygo/issues/2749
2022-04-07 12:00:27 +02:00
Ayke van Laethem c248418dbe compiler: fix a few crashes due to named types
There were a few cases left where a named type would cause a crash in
the compiler. While going through enough code would have found them
eventually, I specifically looked for the `Type().(` pattern: a Type()
call that is then used in a type assert. Most of those were indeed bugs,
although for some I couldn't come up with a reproducer so I left them
as-is.
2020-05-27 16:14:41 +02:00
Ayke van Laethem 01e58691a1 compiler: support constant indices with a named type 2019-10-01 21:31:00 +02:00
Ayke van Laethem fea56d4164 compiler: add support for full slice expression for slicing arrays
This was an oversight in the main commit for full slice expressions:
https://github.com/tinygo-org/tinygo/pull/472
This syntax is used by the regexp package, for example.
2019-08-11 15:37:05 +02:00
Ayke van Laethem 4688664b41 compiler: implement full slice expression
This feature was introduced in Go 1.2 and is used by some standard
library packages.
2019-08-04 17:51:16 +02:00
Ayke van Laethem b837c94366 compiler: calculate max number of entries in slice at compile time
This avoids difficult multiply-with-overflow code and avoids a multiply
at runtime.
2019-03-05 19:25:42 +01:00
Ayke van Laethem 914d383a96 all: update import paths to github.com/tinygo-org/tinygo 2019-01-31 17:43:19 +01:00
Konstantin Yegupov f44dff6f59 compiler: allow slicing arrays of a named type 2019-01-04 15:55:57 +01:00
Ayke van Laethem 8cb7b583d8 compiler: support creating slices with uncommon initial len/cap types 2018-11-18 18:35:29 +01:00
Ayke van Laethem 9bddaae04a compiler: support any int type in slice indexes
Make sure the compiler will correctly compile indexes of type uint64,
for example.
2018-11-14 14:41:40 +01:00
Ayke van Laethem da89464a63 compiler: compare slice against nil 2018-10-20 17:22:51 +02:00
Ayke van Laethem 963ba16d7b compiler: add support for the append builtin 2018-10-19 14:40:19 +02:00
Ayke van Laethem f9edf7cc5c test: add slice tests 2018-10-18 15:02:53 +02:00