Commit graph

283 commits

Author SHA1 Message Date
Inkrementator
0edef23caf
Variant segfault (#10697)
* Reference correct issue for test

* Variant: Fix Segfault on adding in wrapped AA
2025-03-26 07:14:47 +08:00
Inkrementator
67afde4f10
Fix #9585 Add check variant alignment (#10690)
* Fix #9585 Add check `variant` alignment

There has been code that handles alignment for a long time
now, and while this module is unlikely to be touched anymore, create a
regression test so the issue can be closed.

* Apparently double is 32bit aligned on x86
2025-03-19 12:20:30 +08:00
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
Walter Bright
a44abe9167 use cast() where we can 2024-03-08 11:57:50 -08:00
João Lourenço
b901b5fb50
std.variant: Add Variant unittests for 'null' comparisons
Fix Issue #22647 - [std.variant.Variant] Cannot compare types compliant with null comparison with 'null'

Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-01-10 11:35:15 +00:00
João Lourenço
5f14dc0305
std.variant: Fix Variant not correctly comparring allowed types with null
Some types can be compared with 'null', for example arrays and
pointers. Not complying with this creates a difference between the
Phobo's Variant implementation and the core language behaviors which can
lead to some confusion.

Refers: #22647

Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-01-10 11:35:04 +00:00
João Lourenço
5f1657565f std.variant: Fix incorrectly written unittets
Fix Issue 22648 - [std.variant.Variant] Incorrectly written unittests

Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-01-04 00:42:12 +00:00
Imperatorn
112e3a3ec4
Using LINK macro
Using LINK macro instead of escaping seems to work
2021-11-11 08:32:02 +01:00
Imperatorn
cf71d70b19
Fix broken link
@ is not encoded. Replaced with %40
2021-11-10 22:38:51 +01:00
Andrei Alexandrescu
b4fa23ff1e Using std.meta.Alias instead of MutableOf 2021-05-06 13:48:54 -04:00
Per Nordlöw
ec556d2c4c Try to make std.variant.maxSize non-recursive
Use mixin("T...")

Use simpler unique name

Correct name from `maxSizeOf` to `maxSize`

Add more tets

Let mixin do its own implicit concatenation and conversion of i to string

Put braces on separate lines

Use max in test

Ues S.sizeof in one more assert

Use max in one more assert
2021-04-14 14:16:46 +02:00
berni44
7afc9bff9d Fix Issue 18780 - Inconsistent behavior with Variant holding int converting to unsigned types 2021-04-12 18:37:27 +02:00
Paul Backus
51a70ee267
Add sumtype to Phobos (#7702)
Add sumtype to Phobos
merged-on-behalf-of: unknown
2021-03-05 12:41:34 +01:00
Iain Buclaw
79ad118345 Remove tests for complex and imaginary types 2021-01-28 03:05:46 +01:00
Martin Kinkelin
1a459c5996 Get rid of std.conv.emplace[Ref](), use core[.internal].lifetime
The emplace() stuff was moved to druntime; for some reason, it's still
in Phobos.

I've diffed the two versions, and they are still almost identical (incl.
unittests); the druntime version appears to have seen some improvements
(e.g., forwarding r/lvalueness of the arguments) in the meantime.
2021-01-17 16:02:25 +01:00
Martin Kinkelin
f47abdc52b
std.variant: Make use of core.lifetime.copyEmplace() (#7688) 2020-11-04 12:18:02 +08:00
Simen Kjærås
6ee10a49a7 Fix issue 21253 - Can't compile Variant.visit!(...) with generic function 2020-10-31 02:53:54 +01:00
Imperatorn
2cd39dff61 Incorrect link to info about discriminating union
Previous link:
http://erdani.org/publications/cuj-04-2002.html = 404 Not found

New link:
http://erdani.org/publications/cuj-04-2002.php.html = 200 OK
2020-10-22 19:37:45 +09:00
MoonlightSentinel
e824871026 Make Phobos compilable with preview=fieldwise 2020-10-16 11:44:47 +02:00
MoonlightSentinel
c7e49f5afd Fix 21231 - Unreachable warning for empty struct in VariantN...
... with preview=fieldwise.

Equality checks will never fail for instances of empty structs, hence
don't generate code checking `<` and `>` for them.

This was exposed by `-preview=fieldwise` which (as a side effect)
enables dmd to const-fold the aformentioned equality test in the
frontend.
2020-10-16 11:43:10 +02:00
Tomoya Tanjo
aa07861ec7 Fix Variant.opAssign 2020-10-14 21:34:31 +00:00
Tomoya Tanjo
cf9b0c7b0d Fix issue 21296 - std.variant.Variant cannot be initialized with immutable AA 2020-10-07 15:08:01 +02:00
Andrei Alexandrescu
42138c021c
Replace Unqual-based idiom with immutable-based idiom (#7576)
Replace Unqual-based idiom with immutable-based idiom
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2020-08-04 04:32:14 +02:00
Simen Kjærås
ea070e9a5c Fix issue 21021 - std.variant confused by alias this when struct larger than maxDataSize 2020-07-07 12:32:14 +02:00
Geod24
04f3979317 Replace 'Issue XXX' with Bugzilla links
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Bernhard Seckinger
2584fd837f Fix Issue 15940 - ImplicitConversionTargets and class alias in struct 2019-12-10 15:29:18 +01:00
Martin Kinkelin
fe38be185b Fix std.variant unittest
Accomodate for the fact that a `VariantN!24` without explicit allowed
types is at least `real` aligned, and that can be 8 on some platforms
(e.g., 32-bit Windows for LDC with 64-bit `real`), so that the size is
aligned up to `24+4 + /*padding*/ 4 = 32`.
2019-08-29 18:29:35 +03:00
shove70
b289b55b7d Fix issue 19986 - Can't assign large const T to std.Variant.VariantN 2019-07-08 12:10:29 +08:00
The Dlang Bot
d6f1685a5c
Merge pull request #7084 from pbackus/fix-19994
Fix issue 19994 - Can't nest self-referential Algebraic types
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-07-08 05:15:05 +02:00
Mike
e0585fa785 Replace D1 operator overloads with D2 operator overloads 2019-07-04 13:33:53 +09:00
Paul Backus
8124b17e2c Fix issue 19994 - Can't nest self-referential Algebraic types 2019-06-22 16:08:07 -04:00
Kriyszig
c163aeeefc Removed alias 2019-06-21 16:39:52 +05:30
Kriyszig
6da85c4f8c Fix Issue 19987 - Reducing memory used by VariantN
Swapping the fptr and union around will avoid unnecessary padding.
2019-06-21 16:28:06 +05:30
Marco de Wild
613c0b1f72
fix Issue 11061 - Variant of an array can be compared with another array
Fixes 11061
2019-06-06 14:14:20 +02:00
Kriyszig
5c8888f402 variant.d: Gated unittests behind version(StdDdoc)
Prevents compilation of unittests into user modules
fix Issue 18818 - unittests are compiled into user modules
2019-03-31 12:12:27 +05:30
Joakim
073ea406c6 Loosen two tests for IEEE Quadruple precision and make sure std.variant.VariantN is properly aligned for Quadruples. 2018-12-17 19:58:33 +05:30
Iain Buclaw
fd5facfe04 posix.mak: Enforce whitespace before opening parenthesis for version conditions 2018-09-22 16:57:24 +02:00
Basile Burg
9784974742 refactor VariantN using D2 style opOpAssign operator overloads 2018-09-02 16:32:13 +02:00
Nathan Sashihara
af77205b1b Make PR#6684 pass unittests 2018-09-01 15:17:34 -04:00
Biotronic
71fc01cc63 Fix issue 19200 2018-08-28 14:52:02 +02:00
John Colvin
4b787c71fd
fix get and peek links in std.variant docs 2018-08-01 14:19:41 +01:00
Martin Nowak
8d4e3941cf Merge remote-tracking branch 'upstream/master' into stable 2018-06-16 07:27:16 +02:00
Steven Schveighoffer
2de6f8da22 Fix issue 18934 - make std.variant support getting types that have const
members.
2018-06-07 12:43:13 -04:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Martin
a459a23245 Fix std.variant unittest
For all 64-bit targets with real.sizeof < 16, e.g., Win64 MSVC for LDC.
2018-04-26 22:53:59 +02:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Sebastian Wilzbach
43813f75d8 Add public examples to std.variant + DScanner check 2018-03-21 18:54:06 +01:00
Jack Stouffer
663b5b9278 Revert addition of StdUnittest 2018-02-20 13:32:32 -05:00
Eduard Staniloiu
d87f5a981d Make VariantN infer dtor safety from types 2018-02-14 13:57:28 +00:00
Sebastian Wilzbach
1fd20cf0d5
Merge pull request #4204 from Biotronic/fix-10879
Fix Issue 10879 - std.variant Variant/Algebraic: Cant store static ar…
2018-01-31 07:03:44 +01:00