Commit graph

2344 commits

Author SHA1 Message Date
Nicholas Wilson
13775eb2d1
Fix #18235 - Add offending member to "no size because of forward reference" error (#20557)
Co-authored-by: Nick Treleaven <ntrel002@gmail.com>
2024-12-15 18:23:36 +08:00
Paul Backus
6a7bd45a8e Enable -preview=fieldwise by default
Introduced in PR #9331, this was changed from a normal bug fix to a
-preview switch because enabling it triggered a suprious "statement is
not reachable" warning in Phobos. That warning has since been removed
(in PR #15568).
2024-12-08 21:19:17 +01:00
Nick Treleaven
a7f6b04a0c
Don't allow short constructor with non-void expression except this() and super() (#17489) 2024-12-08 17:21:42 +08:00
Dennis Korpel
869ed9c6b9 Fix bugzilla 24891 - Two scope attributes emitted as part of .di generation 2024-12-05 15:03:54 +01:00
Dennis Korpel
4f2ae0e24a hdrgen.d: Deduplicate if/whilte/switch condition printing 2024-12-05 14:08:36 +01:00
Dennis Korpel
56eb579a45 Allow shortened method syntax for constructors 2024-12-04 12:16:44 +01:00
Nicholas Wilson
f28b1a0f0a
make deinitializeDMD reset onlyOneMain check (#17080) 2024-12-04 13:16:31 +02:00
Dennis
b076573644
Merge pull request #17102 from yanok/lambda-mangle2
Make lambda symbols stable post a3abf1187e
2024-12-04 11:46:48 +01:00
Ilya Yanok
451c1596be Make lambda symbols stable post a3abf1187e
Commit a3abf1187e fixes some cases of
lambdas having unstable symbol names between compilation units by
using `generateIdWithLoc` to generate stable lambda names, however since
LOC doesn't uniquely identify a lambda instance (because templates,
mixins, static foreach and foreach unrolling), `generateIdWithLoc`
adds a counter, so there is still some instability going on.

`generateIdWithLoc` makes the name uniq per file+loc, by adding adding a
numeric suffix. But the order of instantiations might be different
across compilation units, so with this counting scheme we are back to
unstable names, so one module might have

`t!0.__lambda_LOC` and
`t!1.__lambda_LOC_1`

while another one has

`t!1.__lambda_LOC`

This is not a critical problem, but at very least the code gets
duplicated for no reason. I also have an example where it leads to
linking error, but since it's not a small one and fails to minimize
further, I suspect it's a result of interaction with some other bug.

The thing is we don't even need uniqueness for those lambdas inside
templates/mixins: their final names will have the instantiation prefix anyway.
But we can't also just disable this uniqueness check completely: `static
foreach` as well as unrollings of the normal `foreach` with lambdas in
the loop body will have several copies of a single lambda with the same
file+loc. So here we do want to keep making them unique. Fortunately, I
don't think a `foreach` could be iterated in different order in
different compilation units, so hopefully if we limit the counting to
this case only, it won't make symbols unstable.

To implement this idea, I've added an extra `parent` argument to
`generateIdWithLoc`: it works like using `parent ~ prefix` prefix, but
without adding `parent` to the final output.

Fixes since last review:
 1. Changed `fromStringz` to `toDString`
 2. Added a test to showcase the problem
2024-12-04 11:04:26 +01:00
Dennis Korpel
bfae7828a9 Cache TypeIdExp::semantic 2024-12-03 23:10:11 +01:00
Walter Bright
d8c0e79bfb
made small improvement to fix 24884 (#17101) 2024-12-02 16:23:34 +08:00
Emmanuel Ferdman
82a5d2a7c4
Fix typo in DMD README (#17100)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-12-01 17:54:52 +08:00
Dennis Korpel
1f0c1c22e9 Remove C++ bitflags / _padding fields from SCOPE 2024-12-01 00:56:02 +01:00
Dennis
f7530ca9e4
Merge pull request #17084 from andreirusanescu/_d_newThrowable_to_lowering
Moved _d_newThrowable in the semantic phase to lowering
2024-11-30 16:33:54 +01:00
Dennis Korpel
74c40e9be0 Merge branch 'stable' into master 2024-11-29 12:46:40 +01:00
Richard (Rikki) Andrew Cattermole
6567f6f4a4 Fix bugzilla issue 24882 - COM class is allocated using GC not malloc 2024-11-29 08:37:07 +01:00
Dennis Korpel
1a44210ffb Fix bugzilla 24883 - Speculative template overload error escapes with -preview=rvaluerefparam 2024-11-29 08:36:13 +01:00
Dennis Korpel
8b1eb80d25 Fix bugzilla 24884 - backend generates wrong 32-bit code after inlining math with double[4] 2024-11-29 08:35:16 +01:00
Walter Bright
347c883586
Implement Safer D (#17044) 2024-11-27 22:59:29 -08:00
Andrei Rusanescu
7c95c88896 Moved _d_newThrowable in the semantic phase to lowering
Pr #14837 added templated lowering for _d_newclass and
lowering field to NewExp. Pr #13494 added templated lowering
for _d_newThroable. This Pr merges those two.

In expressionsem.d, instead of giving up the expression node and
keeping just the id.expressionSemantic of it, the result is the
whole node with all its previous fields and a new one, lowering,
that is set to the previously returned value.

In e2ir.d, for a newExpression, the expression is already created
in the semantic phase with all the arguments needed, so the visitor
will not recreate it, therefore the assert at line 1153 is no longer
necessary.

Signed-off-by: Andrei Rusanescu <andreirusanescu154@gmail.com>
2024-11-27 06:09:07 -05:00
Dennis
a3abf1187e
Fix 23722 - Lambdas are mangled incorrectly when using multiple compi… (#15343)
* Fix 23722 - Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code

* Update test cases
2024-11-27 12:03:16 +01:00
Dennis Korpel
519d388498 Fix bugzilla 24845 - Compiler error when trying to assign to an AA value of an enum instance 2024-11-25 22:54:52 +01:00
The Dlang Bot
949cb11c41
Merge pull request #17082 from ArthaTi/fix-24871
Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2024-11-25 09:35:14 +01:00
Walter Bright
a36acce53f
should no longer need the else clause (#17093) 2024-11-25 00:28:54 -08:00
Artha
0c09587bd7
Strip one space in /// comments 2024-11-25 08:17:24 +01:00
Walter Bright
2a76803fd4
use OutBuffer for getMatchError() (#17091) 2024-11-24 22:00:23 -08:00
Walter Bright
8e8340353d use OutBuffer to build and pass around strings 2024-11-25 02:29:19 +01:00
Walter Bright
4ba34116fc split AttributeViolation into two distinct uses 2024-11-24 23:44:49 +01:00
Nicholas Wilson
726b9bbc4a
Make Array destructor work on default init state (#17081) 2024-11-24 18:43:03 +01:00
Walter Bright
9ac27a88c8 next step to AttributeVfd 2024-11-24 10:18:16 +01:00
Walter Bright
5931100c22
small step towards AttributVfd2 (#17089) 2024-11-23 22:51:42 -08:00
Walter Bright
dfbc380ac3 use va_list instead of template for vprintf 2024-11-24 05:20:54 +01:00
Dennis
1039b0e93d
Update compiler/test/compilable/ddoc24871.d 2024-11-22 15:17:09 +01:00
Artha
303d95f680
Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments
Removes code in the lexer responsible for removing leading spaces in
triple slash doc comments.

This affects the test file for issue 14413; two more spaces appear, but
they are not significant in the HTML output.
2024-11-22 13:00:05 +01:00
Teodor Dutu
f1adbd18a2
dinterpret.d: Remove special case for _d_arrayappend{cTX,T} (#17076)
PR #14985 introduced `LoweredAssignExp` with a separate field to store the
lowering during semantic analysis. Then #15791 placed the lowering of
`CatAssignExp`s into this field, but did not remove the code that was
previously recreating the original `CatAssignExp` from the lowering
during CTFE.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2024-11-19 16:44:12 +01:00
Dennis Korpel
a130fa2d6f Replace GC-allocated printf cstring with length/ptr pair 2024-11-19 12:23:54 +01:00
Walter Bright
268453757d split setFunctionToUnsafe() into two functions 2024-11-19 01:20:30 +01:00
Walter Bright
eac47d73b6 Untangling setUnsafe() 2024-11-17 11:31:37 +01:00
royalpinto007
36c58b7368 fix Bugzilla 24745 - improve associative array syntax error message
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-17 08:08:15 +08:00
royalpinto007
f5f7baeb19 fix Bugzilla 24353 - add mutability check for foreach with opApply
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-17 07:44:19 +08:00
Martin Kinkelin
f485dbfee1
Merge pull request #17069 from kinke/merge_stable
Merge stable
2024-11-17 00:26:59 +01:00
Martin Kinkelin
33e87826df Merge remote-tracking branch 'origin/stable' into merge_stable 2024-11-16 23:31:02 +01:00
Martin Kinkelin
c58e2a766b compilable/stdcheaders.c: Work around unsupported NAN in new WinSDK headers
GitHub Actions upgraded the WinSDK in the latest image, and its NAN is
apparently not supported by ImportC anymore, breaking CI.
2024-11-16 22:08:33 +01:00
Martin Kinkelin
cbcd5b5d9a [mergefix] 2024-11-16 16:10:55 +01:00
Martin Kinkelin
72b2fbe64a Merge remote-tracking branch 'origin/stable' into merge_stable
Conflicts:
	compiler/src/build.d
	compiler/src/dmd/dcast.d
	compiler/src/dmd/dtemplate.d
	compiler/src/dmd/expressionsem.d
2024-11-16 16:09:17 +01:00
Walter Bright
73d56d018a swap error and verror in ErrorSink 2024-11-16 14:16:00 +08:00
Walter Bright
a555e135db fix bugzilla Issue 24861 - Vestige of 16 bit code being accidentally generated 2024-11-15 03:13:19 +01:00
Martin Kinkelin
3d6c65e75d Bit-shift expressions: Cast scalar right-hand-sides to vectors if needed
This promotion from scalar right-hand-sides to vectors already happens
for the arithmetic binops, via `typeCombine()` side effects. Handle
bit-shift expressions too now, by casting a scalar to the left-hand-side
vector type.

This can't be tested with DMD, as DMD's `Target.isVectorOpSupported()`
doesn't support bit-shifts yet. It is ~required/useful for LDC though.
2024-11-14 00:34:20 +01:00
Martin Kinkelin
cb1d6166f1 expressionsem.d: Get rid of duplication for binary bit-op expressions 2024-11-13 15:30:16 +01:00
Martin Kinkelin
70f5c74d14 expressionsem.d: Get rid of duplication for shift expressions 2024-11-13 15:29:33 +01:00