Commit Graph

22 Commits

Author SHA1 Message Date
ringabout
7071e3a080 closes #15778; adds a test case (#23613)
closes #15778

(cherry picked from commit c08356865d)
2024-05-24 15:57:30 +02:00
ringabout
98075688f3 fixes openarray views default values in JS (#23607)
(cherry picked from commit 0fcd838fd9)
2024-05-24 15:57:15 +02:00
ringabout
fa78d937dc fixes #22597; avoid side effects for call returning openArray types (#23257)
fixes #22597

```nim
proc autoToOpenArray*[T](s: Slice[T]): openArray[T] =
  echo "here twice"
  result = toOpenArray(s.p, s.first, s.last)
```
For functions returning openarray types, `fixupCall` creates a temporary
variable to store the return value: `let tmp = autoToOpenArray()`. But
`genOpenArrayConv` cannot handle openarray assignements with side
effects. It should have stored the right part of the assignment first
instead of calling the right part twice.

(cherry picked from commit d44b0b1869)
2024-04-27 20:00:30 +02:00
ringabout
2054f1c3a9 fixes #22117; View types lifetime tracking does not work with defer (#22121) 2023-06-19 15:23:51 +02:00
ringabout
65223e6f59 fixes #21674; lent can be used in the fields or the cast type as a parameter (#21684)
* fixes #21674; `lent` can be used in the fields or the cast type as a parameter

* add a test case

* fix the test
2023-04-18 00:31:47 +08:00
Jason Beetham
da0a2fdca2 Unpack mSlice tupleconstr for static openarrays (#20615) 2022-10-22 06:37:23 +02:00
ringabout
fdc6b0fb6e fixes #19986; mutable view from immutable location (#20134)
* fixes #19986; mutable view from immutable location

* fixes the tests
2022-09-28 14:02:07 +02:00
quantimnot
6289b002b6 [Testament] Extend and document message testing aids (#19996)
* [Testament] Extend and document message testing aids

* Enable inline msgs when not reject action.
Eliminates the pain of changing the line and column numbers in `nimout`
or `output` while making changes to the test.
* Enable using inline msgs and nimout together.
Allows ease of inline msgs for the test as well as testing msgs from
other modules.
* Add path separator and test filename variable interpolation in
msgs.
Eases handling path separators in the msgs.
* Add some documentation.

* Fixed lots of broken tests

* Fixed more broken tests

* Support multiple inline messages per a line

* Fix a broken test

* Revert variable substitution in `output`

* Remove uneeded params

* Update doc/testament.md

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Update testament/specs.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Update testament/specs.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>

* Fix indentation

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-09-01 17:52:13 +02:00
flywind
4897c47c80 closes #15897; add testcase (#19961) 2022-07-02 16:51:21 +08:00
flywind
9df195ef58 style usages part one (openarray => openArray) (#19321)
* style usages (openArray)

* revert doc changes
2022-01-04 13:29:50 +01:00
Andreas Rumpf
576fece909 fixes 'lent T' inside object constructor [backport] (#18911)
* fixes 'lent T' inside object constructor [backport]

* progress
2021-09-27 22:23:31 +02:00
Andreas Rumpf
7e5eab571e closes #18690; make view types stricter [backport] (#18891)
* closes #18690

* don't allow capturing of view types [backport]
2021-09-24 16:27:34 +02:00
Andreas Rumpf
6163bdd279 closes #16132 [backport] (#18880)
* closes #16132 [backport]

* fixes #16132 [backport]
2021-09-22 15:07:36 +02:00
Andreas Rumpf
2ea7287217 view types: spec changes (#18226)
* view types: spec changes

* Update doc/manual_experimental.rst

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update doc/manual_experimental.rst

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-06-10 16:49:17 +02:00
flywind
7bfb9f0002 close #17636 (#17643) 2021-04-06 16:20:01 +02:00
Andreas Rumpf
cf01945f54 ensure the Nim compiler works with --experimental:strictFuncs --experimental:views [backport:1.4] (#15737) 2020-10-26 21:08:57 +01:00
Andreas Rumpf
64016ddedc fixes view types for sizeof() and --gc:orc (#15680) 2020-10-22 18:52:05 +02:00
Andreas Rumpf
4e438f9096 const view types; fixes some cases from https://github.com/nim-lang/Nim/issues/15428 (#15488) 2020-10-05 18:31:46 +02:00
Andreas Rumpf
86d7b63e2a better support for view types (#15436)
* you can put borrows into tables

* enforces mutating views only mutate mutable data
2020-09-30 20:44:18 +02:00
Andreas Rumpf
4058801607 spec for view types (#15424)
* spec for view types
* spec additions
* refactoring; there are two different kinds of views
* refactorings and spec additions
* enforce that view types are initialized
* enforce borrowing from the first formal parameter
* enforce lifetimes for borrowing of locals
* typo in the manual
* clarify in the implementation what a borrow operation really is
2020-09-29 23:42:38 +02:00
Andreas Rumpf
f1ac01459c produce runtime type information for reified openArrays (#15415)
* produce runtime type information for reified openArrays

* added a test case
2020-09-27 20:44:22 +02:00
Andreas Rumpf
57b7841c18 better support for slices as views (#15414)
* moved view tests to tests/views
* refactoring
* more refactorings
* better support for system.toOpenArray for first class view types
2020-09-27 09:20:10 +02:00