Commit graph

759 commits

Author SHA1 Message Date
MoonlightSentinel
bb2b31f892 Fix 22383 - Reject noreturn[] as an autodecodable string
`noreturn[]` does not contain characters and hence is not subject to
autodecoding. The previous behaviour caused the range primitives (`put`,
...) to call into autodecoding related functions which couldn't handle
`noreturn[]`.
That error caused `isInputRange!(noreturn[])` to yield false.
2021-10-14 17:23:16 +00:00
MoonlightSentinel
b612caa162
Fix 22368 - has[Unshared]Aliasing fails to instantiate for noreturn
The problem was that `noreturn` matched the special case for `Rebindable`
because the bottom type is implicitly convertible to any type.
2021-10-08 19:23:04 +02:00
Paul Backus
2cb2d6cd67 Refactor std.traits.EnumMembers 2021-10-03 22:13:35 +00:00
RazvanN7
3e7e0393e8 Re-add std.traits.Fields test with interface 2021-09-15 13:02:59 +00:00
RazvanN7
044b4a1b02 Temporarily comment one test in traits to be able to graciously fix druntime implementation 2021-09-15 09:35:04 +00:00
Per Nordlöw
6333fe3206 Replace template AliasThisTypeOf with inlined calls to __traits 2021-09-15 08:40:39 +00:00
Manu Evans
b86bb94ab9
Alias traits from druntime (#7148)
Alias traits from druntime

Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Signed-off-by: Eduard Staniloiu <edi33416@users.noreply.github.com>
Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-09-15 07:38:59 +00:00
Per Nordlöw
c799010b64
Make alias templates to core.internal.traits symbolic aliases to avoid extra te… (#8227)
Make alias templates to core.internal.traits symbolic aliases to avoid extra te…

Signed-off-by: Andrei Alexandrescu <andralex@users.noreply.github.com>
Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: unknown
2021-09-03 13:03:53 +00:00
Razvan Nitu
dc06862fa0
Merge pull request #8176 from ljmf00/fix-functiontypeof
Fix Issue #22140: FunctionTypeOf fails for template opCall without any templated argument
2021-08-04 15:20:31 +08:00
Luís Ferreira
84f7c9b4b5
std/traits: FunctionTypeOf fails for template opCall
Fixes Issue #22140 .

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-08-04 01:47:07 +01:00
Geod24
c01b9a5b6f Remove dead demangling code for funcattr / param stc
This code is dead since we now have a dedicated trait in the frontend,
instead of deriving it from the mangling.
2021-08-03 17:54:31 +09:00
Martin Nowak
3fff60bc50 Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-07-13 12:24:06 +02:00
Luís Ferreira
5ed958c773
Fix #22110: std.traits: isCallable fails for templated opCall (#8161)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-07-08 06:45:54 +08:00
Nathan Sashihara
61c00065a8 Streamline std.traits.BuiltinTypeOf & IntegralTypeOf
This incidentally fixes a 'TODO' in BuiltinTypeOf: ifloat/idouble/ireal
and cfloat/cdouble/creal were being collapsed to ireal and creal and
their qualifiers were being discarded.
2021-06-22 12:32:40 +00:00
Nathan Sashihara
136b750df1 Improve memory usage & speed of std.traits.isIntegral & isSomeChar 2021-06-21 10:12:39 +00:00
Nathan Sashihara
6c329ba358 Fix 22056, 22057, 22058 - [Reg 2.074] std.traits.isFloatingPoint, isNumeric, isUnsigned, and isSigned should never be true for SIMD vectors, imaginary/complex numbers, or enums with character base types 2021-06-21 05:26:43 -04:00
The Dlang Bot
048df4a66c
Merge pull request #8048 from andralex/SharedConstInoutOf
Add missing SharedConstInoutOf and refactor QualifierOf
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-05-25 13:05:36 +02:00
avaj
8b31d022f0 std.traits: Fix unittest for isNumeric 2021-05-18 05:13:18 +02:00
Andrei Alexandrescu
5c931c89fa Replace the use of format() during compilation in std.traits with concatenations 2021-05-11 09:40:56 +02:00
Andrei Alexandrescu
e7954f1be1 Simplify definitions of XxxOf 2021-05-06 14:14:37 -04:00
Andrei Alexandrescu
b4fa23ff1e Using std.meta.Alias instead of MutableOf 2021-05-06 13:48:54 -04:00
Andrei Alexandrescu
272b4b3bb7 Better implementation 2021-05-06 12:38:34 -04:00
Andrei Alexandrescu
02e56b3681 Add missing SharedConstInoutOf and refactor QualifierOf 2021-05-06 12:38:34 -04:00
Florian
f2ad29e5b2
Sync Fields with FieldNameTuple for interfaces (#8023)
Sync Fields with FieldNameTuple for interfaces
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-05-03 12:55:23 +02:00
Mathis Beer
2fac584959 Fix issue 20756: Handle interface argument in AllImplicitConversionTargets. 2021-04-27 13:42:06 +02:00
MoonlightSentinel
95bfdd78e8 Revert change to FieldNameTuple for non-interface types 2021-04-27 10:34:10 +02:00
MoonlightSentinel
3ded2f5c50 Fix 21863 - FieldNameTuple returns emptry string for interfaces
Symbols without members should produce an empty tuple. `""` is also
not a member and hence requires additional special casing.
2021-04-26 14:45:36 +09:00
berni44
af8fd8ede1 Deprecate ImplicitConversionTarget 2021-04-14 14:16:50 +02:00
berni44
eb1cdabdca Add AllImplicitConversionTargets and SafeImplicitConversionTargets 2021-04-12 08:03:28 +02:00
berni44
459f271fbe Remove two unnecessary 'the' in documentation. 2021-03-19 00:17:27 +01:00
Nathan Sashihara
edc5961693 Simplify std.traits.isFunctionPointer & std.traits.isDelegate 2021-03-10 00:20:41 +01:00
Iain Buclaw
79ad118345 Remove tests for complex and imaginary types 2021-01-28 03:05:46 +01:00
MoonlightSentinel
67eb976fea Fix Issue 21103 - isDynamicArray instantiates unecessary templates
Use an `is(...)` expression to do the actual check but include a
workaround to reatin the old (buggy) behaviour regarding enums (for now).
2021-01-22 18:27:26 +01:00
MoonlightSentinel
ad8e138eb4 Make isAutoDecodableString independent of issue 21570
The current implementation relies on issue 21570 to reject enums with
static arrays as their base type.

Use another is-expression instead of `isStaticArray` to detect types
that are (convertible to) static arrays.

See https://issues.dlang.org/show_bug.cgi?id=21570
2021-01-22 00:21:16 +01:00
berni42
5c3028789e Fix issue 21444: bad string concat in static assert message 2021-01-18 01:03:40 +01:00
Q. F. Schroll
d64b78e27d fix Issue 21452 - isCallable erroneously returns false on function templates 2020-12-04 01:09:19 +01:00
Nathan Sashihara
9a85496b9a Fix Issue 15425 - std.traits.hasIndirections fails to recognize nested structs 2020-11-18 01:50:27 +01:00
Nathan Sashihara
25348d61dd Simplify std.traits.isBoolean 2020-11-07 14:20:13 +01:00
Nathan Sashihara
aa16e2d99a Streamline std.traits.AliasThisTypeOf
Faster and uses less memory.
2020-09-14 05:35:35 +02:00
Paul Backus
33b1c17540 Fix issue 21237: isLvalueAssignable and isRvalueAssignable should be public 2020-09-12 14:03:14 +02:00
Nathan Sashihara
2f67646b16 Slightly decrease trait template cascades 2020-09-12 12:28:43 +02:00
Geod24
35016ff42d std.traits: Adapt unittest to pass with -preview=in 2020-08-31 05:32:26 +02:00
Geod24
4d01cacfb4 Fix 21210: std.traits : isAssignable false positive on disabled copy struct
`isAssignable` would previously return `true` for non-copyable types,
even though code that tried to use an lvalue would not compile.
This behavior was originally found when implementing `-preview=in`.

With the new -preview=in check, the const-folding seemed to be a bit
too aggressive when an rvalue is passed, meaning that the check might
fail (probably due to the code that initialize the temporary).
2020-08-31 03:13:56 +02:00
Sebastian Wilzbach
1af4e48c4e Revert "std.traits: Adapt unittest to pass with -preview=in (#7609)"
This reverts commit aca1e1208f.
2020-08-30 11:07:05 +02:00
Mathias LANG
aca1e1208f
std.traits: Adapt unittest to pass with -preview=in (#7609)
* std.traits: Use delegates within some __traits(compiles) check to avoid constfold

With the new -preview=in check, the const-folding seems to be a bit
too aggressive when an rvalue is passed, meaning that the check might
fail (probably due to the code that initialize the temporary).
To avoid this issue, we simply wrap the assignment in a lambda that
will not be called, as there is no downside to that change.

* std.traits: Adapt unittest to pass with `-preview=in`
2020-08-29 19:42:12 +08:00
Nathan Sashihara
99e390486c Reduce the number of isAggregateType!T checks
Some are redundant. Others can be replaced by cheaper traits checks.
2020-08-18 03:50:12 +02:00
Nathan Sashihara
453faadf5b Replace is(Unqual!T == Unqual!U) with is(immutable T == immutable U) for speed & memory usage 2020-08-03 15:07:32 +02:00
Geod24
1e73cb8ca7 std.traits: Add support for 'in' storage class
For a long time, the 'in' storage class was only a second class citizen,
merely an alias for 'const', which is a type constructor.
While it was also documented for a long time as being 'scope',
this was removed when 'scope' actually started to have an effect
(when DIP1000 started to be implemented).
Currently, a switch (-preview=in) allows to get back this 'scope'.

However, the 'in' storage class does not really exists,
it gets lowered to 'const [scope]' at an early stage by the compiler,
which means that we expose what is essentially an implementation
detail to the user.

There is a PR in DMD (dlang/dmd#11474) that aims to give 'in' an actual
identity, instead of it being lowered to 'const [scope]'.
The underlying motivation is to allow for extending 'in''s functionality,
giving it the ability to pass by 'ref' when necessary, and accept rvalues.

However, regardless of the second goal, having proper support for 'in'
would lead to less confusing messages, better code generation,
and less confusion w.r.t. the behavior of `std.traits.ParameterStorageClass`.
2020-08-01 19:39:20 +09:00
Per Nordlöw
8ef03bc2ee
Reuse new builtin trait isCopyable in std.traits.isCopyable (#7522) 2020-07-17 09:46:32 +08:00
Hiroki Noda
7fa4aaf86f std.traits: FunctionAttribute supports live function 2020-05-22 12:36:13 +09:00