- Notifications
You must be signed in to change notification settings - Fork832
Open
Labels
Milestone
Description
FCS crashes, incorreectly claiming (I think) that the'appEvent generic is required to have comparison, when accessing theImmediateSubexpressions in this small valid F# library.
namespaceFootypeBar<'appEvent>=| Wibbleof'appEvent
I saw this in the wild when trying to run an Ionide F# analyzer against one of my own projects (I originally raised that bug asionide/FSharp.Analyzers.SDK#276 ).
Repro steps
// TestThing.fsnamespaceWoofWare.Zoomies.TestopenSystemopenSystem.IOopenFSharp.Compiler.CodeAnalysisopenFSharp.Compiler.SymbolsopenFSharp.Compiler.TextopenFsUnitTypedopenNUnit.Framework[<TestFixture>]moduleTestWorldFreezer=[<Test>]let``demo of bug``()=task{lets="""namespace Footype Bar<'appEvent> = | Wibble of 'appEvent"""letoutFile= Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()+".fsx")try File.WriteAllText(outFile, s)letchecker= FSharpChecker.Create(keepAssemblyContents=true)let!options,_diags= checker.GetProjectOptionsFromScript(outFile, SourceText.ofString s)let!t,u= checker.ParseAndCheckFileInProject(outFile,0, SourceText.ofString s, options) t.Diagnostics.Length|> shouldEqual0letv=match uwith| FSharpCheckFileAnswer.Succeeded x-> x| FSharpCheckFileAnswer.Aborted-> failwith"bad"letdecl=let recgo(decl:FSharpImplementationFileDeclaration)=match declwith| FSharpImplementationFileDeclaration.Entity(_, declarations)-> declarations|> List.iter go| FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(_,_, e)-> e.ImmediateSubExpressions|> ignore|_-> failwith"no" go(v.ImplementationFile.Value.Declarations|> List.exactlyOne)return()finallytry File.Delete outFilewith|_->()}
<ProjectSdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net9.0</TargetFramework> <IsPackable>false</IsPackable> <OutputType>Exe</OutputType> </PropertyGroup> <ItemGroup> <CompileInclude="TestThing.fs" /> </ItemGroup> <ItemGroup> <PackageReferenceInclude="FsCheck"Version="3.3.1" /> <PackageReferenceInclude="FsUnit"Version="7.1.1"/> <PackageReferenceInclude="Microsoft.NET.Test.Sdk"Version="17.14.1"/> <PackageReferenceInclude="FSharp.Compiler.Service"Version="[43.10.100]" /> <PackageReferenceInclude="FSharp.Core"Version="10.0.100" /> <PackageReferenceInclude="NUnit"Version="4.3.2" /> <PackageReferenceInclude="NUnit3TestAdapter"Version="5.0.0" /> </ItemGroup></Project>
Run the test.
Expected behavior
The test passes, having successfully visited each node of the TAST.
Actual behavior
FSharp.Compiler.DiagnosticsLogger+ReportedError : The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: ConstraintSolverMissingConstraint ({ includeStaticParametersInTypeNames = false openTopPathsSorted = Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]]] openTopPathsRaw = [] shortTypeNames = false suppressNestedTypes = false maxMembers = None showObsoleteMembers = false showHiddenMembers = false showTyparBinding = false showInferenceTyparAnnotations = false suppressInlineKeyword = true suppressMutableKeyword = false showMemberContainers = false shortConstraints = false useColonForReturnType = false showAttributes = false showCsharpCodeAnalysisAttributes = false showOverrides = true showStaticallyResolvedTyparAnnotations = true showNullnessAnnotations = None abbreviateAdditionalConstraints = false showTyparDefaultConstraints = false showDocumentation = false shrinkOverloads = true printVerboseSignatures = false escapeKeywordNames = false g = <TcGlobals> contextAccessibility = public generatedValueLayout = <fun:Empty@3244> genericParameterStyle = Implicit }, appEvent, SupportsComparison (4,6--4,12), (4,6--4,12), (4,6--4,12))) at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.DiagnosticsLogger.Error[T](DiagnosticsLogger x, Exception exn) in D:\a\_work\1\s\src\fsharp\src\Compiler\Facilities\DiagnosticsLogger.fs:line 475 at FSharp.Compiler.DiagnosticsLogger.CommitOperationResult[T](OperationResult`1 res) in D:\a\_work\1\s\src\fsharp\src\Compiler\Facilities\DiagnosticsLogger.fs:line 664 at FSharp.Compiler.Symbols.FSharpExprConvert.GetWitnessArgs(SymbolEnv cenv, ExprTranslationEnv env, ValRef vref, Range m, FSharpList`1 tps, FSharpList`1 tyargs) in D:\a\_work\1\s\src\fsharp\src\Compiler\Symbols\Exprs.fs:line 519 at FSharp.Compiler.Symbols.FSharpExprConvert.ConvModuleValueOrMemberUseLinear(SymbolEnv cenv, ExprTranslationEnv env, Expr expr, ValRef vref, ValUseFlag vFlags, FSharpList`1 tyargs, FSharpList`1 curriedArgs, FSharpFunc`2 contF) in D:\a\_work\1\s\src\fsharp\src\Compiler\Symbols\Exprs.fs:line 505 at FSharp.Compiler.Symbols.FSharpExprConvert.ConvExprOnDemand@1339.Invoke(Unit unitVar0) in D:\a\_work\1\s\src\fsharp\src\Compiler\Symbols\Exprs.fs:line 1339 at FSharp.Compiler.Symbols.FSharpExpr.get_E() in D:\a\_work\1\s\src\fsharp\src\Compiler\Symbols\Exprs.fs:line 153 at FSharp.Compiler.Symbols.FSharpExpr.get_ImmediateSubExpressions() in D:\a\_work\1\s\src\fsharp\src\Compiler\Symbols\Exprs.fs:line 157Known workarounds
none
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
New