Commit graph

1027 commits

Author SHA1 Message Date
Walter Bright
cdc7334e44
fix issue 20562 returning __rvalue should move-construct the NRVO value (#20585) 2024-12-23 13:08:50 +08:00
Walter Bright
bf3f49ac79 optimize s=s where s is a struct 2024-12-18 16:51:23 -08:00
Walter Bright
b7a3a1942c
fix Issue 20567 returning the result of a constructor should be NRVO (#20568) 2024-12-18 00:48:52 -08:00
Walter Bright
85fe931daa
fix github issue 20754 replace a?b:b with a,b when optimized (#20575) 2024-12-17 23:59:42 -08:00
Royal Simpson Pinto
59883ab71e
feat(errors): implement verrors=simple to skip context printing (#20566)
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-12-18 11:53:37 +08:00
The Dlang Bot
059b1ab407
Merge pull request #20559 from KitsunebiGames/objc
Objective-C Improvements

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Dennis <dkorpel@users.noreply.github.com>
2024-12-15 22:48:39 +01:00
Walter Bright
a99a3894be
add __rvalue(expression) builtin (#17050) 2024-12-15 12:13:28 -08:00
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
LunaTheFoxgirl
0845895659 Objective-C classes do not have invariants, null check directly. 2024-12-14 19:26:08 +01:00
LunaTheFoxgirl
2aa9f23110 Remove super-call in test 2024-12-14 18:35:42 +01:00
LunaTheFoxgirl
8a7108f8c9 Skip selector-gen for templates 2024-12-14 17:30:26 +01:00
LunaTheFoxgirl
8f1803391c Add newline to test 2024-12-14 16:53:25 +01:00
LunaTheFoxgirl
5b9e712f87 Add test for automatic selector generation 2024-12-14 16:42:39 +01: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
56eb579a45 Allow shortened method syntax for constructors 2024-12-04 12:16:44 +01: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
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
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
Artha
0c09587bd7
Strip one space in /// comments 2024-11-25 08:17:24 +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
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
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
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
Dennis Korpel
f6115f0335 Fix bugzilla 24855 - VRP fails to prevent overflow after division 2024-11-13 01:49:06 +01:00
royalpinto007
33cd3b3981 fix(errors): align errorKindToString with SARIF level values
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-12 08:12:40 +01:00
royalpinto007
dc5f8db05c feat(errors): consolidate multiple sarif reports into a single report
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): buffer size

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): diagnostics array

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): repeated sarif blocks in errors.d and sarif.d

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): pre-commit checks

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): circleci build

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): Ddoc comments and docs

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): plugSink function by adding early return for empty diagnostics

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): remove unnecessary change

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): global array initialisation

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): separate formatting message

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): dDoc comments

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-11 14:38:46 +08:00
Richard (Rikki) Andrew Cattermole
a7c85ec3be Fix bugzilla issue 24846 - atomicLoad does not work for class arguments with -preview=nosharedaccess 2024-11-11 05:39:57 +08:00
Walter Bright
b70e66033c
add __traits getBitfieldOffset and getBitfieldWidth (#17043) 2024-11-10 20:22:59 +01:00
Nick Treleaven
e20ee14c6c Add workaround for weird __error/_error_ output on different machines 2024-11-08 13:36:37 +00:00
Nick Treleaven
5d01f144e2 Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp 2024-11-08 13:08:02 +00:00
royalpinto007
7c8e8ec2e5 feat(errors): generate sarif report on successful execution
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): tests dDoc, implicit conversion

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): implicit conversion

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): brace, default parameters, invert if-else

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): pre commit checks

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): arguments

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): va_list

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): imports

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): imports

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): va_list

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): va_list

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(errors): va_list passing

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(tests): arg placement

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(regex): Add custom regex-like parsing for version extraction

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(regex): Add custom regex-like parsing

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>

fix(regex): version with regex, remove custom regex parser

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-06 23:36:30 +01:00
bangbangsheshotmedown
c1a753bca3
Fix bugzilla issue 24153 - Inliner breaks -betterC by requiring TypeInfo (#17049) 2024-11-03 15:35:32 +08:00
royalpinto007
2b89c2909d enhance(errors): set dynamic ruleId based on ErrorKind
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-11-02 06:27:18 +08:00
Royal Simpson Pinto
6c09f58feb
feat(errors): integrate warnings and enhance SARIF formatting (#17032)
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-10-27 12:39:38 +08:00
royalpinto007
140ccdd586 fix(errors): skip normal error output when SARIF is enabled
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
2024-10-25 23:22:12 +02:00
Walter Bright
735193cc36 fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit (#17023)
(cherry picked from commit 88d1e8fc37)
2024-10-25 01:47:41 +02:00
Dennis
d0eb6bb659
Fix bugzilla 24832 - Segfault in hex string (#17024)
* Fix bugzilla 24832 - Segfault in hex string

* Fix lack of camelcasing on stable branch
2024-10-24 19:45:57 +02:00
Walter Bright
88d1e8fc37
fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit (#17023) 2024-10-24 13:01:19 +02:00