[Repo Assist] Add isStruct convenience parameter to ProvidedTypeDefinition#464
Draft
github-actions[bot] wants to merge 2 commits intomasterfrom
Draft
Conversation
Adds an optional `?isStruct: bool` parameter to both public constructors
of `ProvidedTypeDefinition`. When `isStruct = true`:
- The `TypeAttributes.SequentialLayout` flag is added automatically
- The base type defaults to `Some typeof<System.ValueType>` when `None`
is passed (i.e., no explicit base type given)
This makes it easy to generate struct value types without needing to
remember to set the base type explicitly:
ProvidedTypeDefinition("Point", None, isStruct = true, isErased = false)
The traditional approach still works unchanged:
ProvidedTypeDefinition("Point", Some typeof<System.ValueType>, isErased = false)
Changes:
- ProvidedTypes.fs: add isStruct to defaultAttributes, both public ctors
- ProvidedTypes.fsi: update constructor signatures
- tests/GenerativeStructProvisionTests.fs: 4 new tests covering
IsValueType, IsSealed, SequentialLayout, and the traditional approach
- FSharp.TypeProviders.SDK.Tests.fsproj: include new test file
All 108 tests pass (104 existing + 4 new).
Co-authored-by: Copilot <[email protected]>
This was referenced Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Adds an optional
?isStruct: boolparameter to both public constructors ofProvidedTypeDefinition. This is a Task 10 improvement that makes generating struct value types more discoverable and convenient.Motivation
Creating a generative struct type provider currently requires knowing to set
baseType = Some typeof(System.ValueType)explicitly:With this change, users can use a named parameter that mirrors the existing
isInterface,isAbstract,isSealedpattern: