Skip to content

Bugfix for Array.insertManyAt returns original array for empty inserion (#18352)#18353

Merged
psfinaki merged 2 commits into
dotnet:mainfrom
i-shm:fix.18352
Mar 10, 2025
Merged

Bugfix for Array.insertManyAt returns original array for empty inserion (#18352)#18353
psfinaki merged 2 commits into
dotnet:mainfrom
i-shm:fix.18352

Conversation

@i-shm

@i-shm i-shm commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

Description

Use array.Clone() to fix the bug that Array.insertManyAt directly returning source array when the values inserted are empty.

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

@github-actions

github-actions Bot commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/FSharp.Core docs/release-notes/.FSharp.Core/9.0.300.md

@psfinaki

psfinaki commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

Hi @muqiuhan - thanks for the contribution. Could you please add a test for the fix?

@i-shm

i-shm commented Mar 3, 2025 via email

Copy link
Copy Markdown
Contributor Author

@albert-du

Copy link
Copy Markdown
Contributor

👍

@psfinaki psfinaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty, I think this is the right fix.

Please add release notes and optionally a comment for the change, referencing the issue.

Thanks!

@KevinRansom

KevinRansom commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

In my heart, this isn't a bug, inserting an empty array into an array should not result in a copy, however, both append and concat with empty arrays do, and so I must reluctantly approve.
Array.append [||]
image

Array.concat [||]
image

…ion (dotnet#18352)

- Update test, release note and comment for Array.InsertManyAt
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Mar 10, 2025
@psfinaki

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@psfinaki

Copy link
Copy Markdown
Contributor

/azp run

@psfinaki psfinaki enabled auto-merge (squash) March 10, 2025 12:48
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@psfinaki psfinaki merged commit 7cb2cea into dotnet:main Mar 10, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Array.insertManyAt returns original array for empty insertion

5 participants