Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add regression tests for FSharpPlus consumer scenarios affected by F# 9#19008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/add-regression-tests-fsharp-plus

Conversation

Copy link
Contributor

CopilotAI commentedOct 16, 2025
edited
Loading

This PR adds regression tests documenting two consumer-side failures reported inFSharpPlus issue #613 that occur with F# 9.

Overview

The tests reproduce real-world FSharpPlus patterns that currently fail to compile in F# 9, serving as regression tests to track when these issues are resolved in the compiler.

Test Scenarios

1. monad.plus SRTP Pattern (Currently Failing)

Tests the use of statically resolved type parameters (SRTP) for ad-hoc polymorphism with overloaded static members:

typeMonadPlusClass=static member inlineMPlus(x:option<'a>,y:option<'a>)=...static member inlineMPlus(x:list<'a>,y:list<'a>)=...let inlinemplus(x:^M)(y:^M):^M=((^MonadPlusClassor^M):(static memberMPlus:^M*^M->^M)(x, y))letresult:int option= mplus(Some1)(Some2)// Fails with type constraint mismatch

Current Error:Type constraint mismatch when applying the default type 'obj' for a type inference variable. None of the types 'obj, int option' support the operator 'MPlus'

2. Custom ResultTBuilder (Currently Passing)

Tests defining a custom computation expression builder for Result types:

typeResultTBuilder()=member inline_.Return(x:'T):Result<'T,'Error>= Ok xmember inline_.Bind(m,f)=...// ... other membersletresultT= ResultTBuilder()letcompute x y=    resultT{let!a= Ok xlet!b= Ok yreturn a+ b}

This scenario currently works correctly in F# 9.

Test Configuration

Each test runs with three compiler configurations:

  • --langversion:8.0 - F# 8 baseline
  • --langversion:preview - F# 9 preview
  • --langversion:preview --checknulls+ - F# 9 preview with nullable reference types

Implementation Details

  • UsesFSharpScript interactive API for scripting evaluation
  • Tests are structured as xUnitTheory tests withInlineData parameters
  • Located intests/FSharp.Compiler.ComponentTests/Language/FSharpPlusRegressionTests.fs
  • Tests assert compilation success, documenting expected behavior

Test Results

Test run summary:- monad.plus usage (3 scenarios): ❌ All failing - documents SRTP regression- ResultTBuilder usage (3 scenarios): ✅ All passing - pattern works correctly

The failing monad.plus tests will serve as indicators when the SRTP resolution issue is fixed in the F# compiler.

Running the Tests

# Run all FSharpPlus regression testsdotnettest tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj \    --filter"FullyQualifiedName~FSharpPlusRegressionTests"# Run specific testdotnettest tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj \    --filter"FullyQualifiedName~monad.plus"

Related Issues

Original prompt

Add regression tests for FSharpPlus consumer scenarios affected by F# 9. These tests should reproduce two consumer-side failures described in the last comment offsprojects/FSharpPlus#613: (1) usage of monad.plus, and (2) defining a custom ResultTBuilder. For each, write a Theory test with InlineData that runs against three compiler settings: (a) --langversion:8, (b) --langversion:preview, (c) --langversion:preview with --checknulls+ and --checknulls-. The tests should use the FSharpScript interactive scripting API, and should assert compilation success (i.e., as if the code should work), even though they are expected to fail with current F# 9 builds. Include collapsible markdown instructions in the PR body, detailing exactly what, where, and how is being tested.

This pull request was created as a result of the following prompt from Copilot chat.

Add regression tests for FSharpPlus consumer scenarios affected by F# 9. These tests should reproduce two consumer-side failures described in the last comment offsprojects/FSharpPlus#613: (1) usage of monad.plus, and (2) defining a custom ResultTBuilder. For each, write a Theory test with InlineData that runs against three compiler settings: (a) --langversion:8, (b) --langversion:preview, (c) --langversion:preview with --checknulls+ and --checknulls-. The tests should use the FSharpScript interactive scripting API, and should assert compilation success (i.e., as if the code should work), even though they are expected to fail with current F# 9 builds. Include collapsible markdown instructions in the PR body, detailing exactly what, where, and how is being tested.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
CopilotAI changed the title[WIP] Add regression tests for FSharpPlus consumer scenariosAdd regression tests for FSharpPlus consumer scenarios affected by F# 9Oct 16, 2025
CopilotAI requested a review fromT-GroOctober 16, 2025 09:54
Copilot finished work on behalf ofT-GroOctober 16, 2025 09:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@T-GroT-GroAwaiting requested review from T-Gro

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

Status: New

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@T-Gro

[8]ページ先頭

©2009-2025 Movatter.jp