Skip to content

Commit f50d5db

Browse files
[repo-assist] refactor: use isNull instead of <> null for BaseType checks (#538)
🤖 *This is an automated pull request from Repo Assist, an AI assistant. Please review carefully before merging.* ## Summary - Refactor: replace `ptdT.BaseType <> null` with `not (isNull ptdT.BaseType)` at the two delegate-type-detection sites in the generative assembly compiler (`src/ProvidedTypes.fs`). ## Rationale `dotnet fsharplint` (rule [FL0065]((fsprojects.github.io/redacted) flagged both occurrences: idiomatic F# prefers `isNull`/`not (isNull ...)` over structural inequality (`<> null`) against reference types, since `<>` on some types can invoke a custom equality implementation rather than a plain reference/null check. `isNull` is the intended, purpose-built operator for this check. ## Trade-offs - Purely cosmetic/idiomatic — no behavioral change. `BaseType` is a `System.Type`, whose default equality is reference-based, so `<> null` and `not (isNull ...)` are semantically identical here; the change only improves clarity and lint-cleanliness. ## Test Status - `dotnet build src/FSharp.TypeProviders.SDK.fsproj -c Release`: **Passed** — 0 warnings, 0 errors (netstandard2.0 + net8.0) - `dotnet test tests/FSharp.TypeProviders.SDK.Tests.fsproj -c Release`: **Passed** — 165/165 tests, 0 failures, 0 skipped - `dotnet fsharplint lint src/FSharp.TypeProviders.SDK.fsproj`: the two FL0065 warnings are resolved; two unrelated pre-existing FL0072 (`failwith` argument uniqueness) warnings remain and are out of scope for this change. > Generated by 🌈 Repo Assist, see [workflow run](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/35183734406). [Learn more](https://github.com/githubnext/agentics/blob/main/docs/repo-assist.md). > <sub>Comment <em>/repo-assist</em> to run again</sub> > <details> <summary><sub>Add this agentic workflow to your repo</sub></summary> To install this agentic workflow, run ``` gh aw add githubnext/agentics@4bc8419 ``` </details> <!-- gh-aw-agentic-workflow: Repo Assist, engine: copilot, model: auto, id: 35183734406, workflow_id: repo-assist, run: https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/runs/35183734406 --> <!-- gh-aw-workflow-id: repo-assist --> <!-- gh-aw-workflow-call-id: fsprojects/FSharp.TypeProviders.SDK/repo-assist --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4f22d31 commit f50d5db

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/ProvidedTypes.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15982,7 +15982,7 @@ namespace ProviderImplementation.ProvidedTypes
1598215982
match ptdT with
1598315983
| None -> ()
1598415984
| Some ptdT ->
15985-
let isDelegateType = ptdT.BaseType <> null && ptdT.BaseType.FullName = "System.MulticastDelegate"
15985+
let isDelegateType = not (isNull ptdT.BaseType) && ptdT.BaseType.FullName = "System.MulticastDelegate"
1598615986
for cinfo in ptdT.GetConstructors(bindAll) do
1598715987
match cinfo with
1598815988
| :? ProvidedConstructor as pcinfo when not (ctorMap.ContainsKey pcinfo) ->
@@ -16065,7 +16065,7 @@ namespace ProviderImplementation.ProvidedTypes
1606516065

1606616066
// Delegate types (base = System.MulticastDelegate) use Runtime implementation; their
1606716067
// constructor and Invoke/BeginInvoke/EndInvoke bodies are synthesised by the CLR.
16068-
let isDelegateType = ptdT.BaseType <> null && ptdT.BaseType.FullName = "System.MulticastDelegate"
16068+
let isDelegateType = not (isNull ptdT.BaseType) && ptdT.BaseType.FullName = "System.MulticastDelegate"
1606916069

1607016070
// Allow at most one constructor, and use its arguments as the fields of the type
1607116071
let ctors =

0 commit comments

Comments
 (0)