Address additional signature generation roundtrip bugs#19609
Open
Address additional signature generation roundtrip bugs#19609
Conversation
Swept 1483 .fs files from tests/fsharp/ and tests/service/data/. Results: 89 pass, 1 real sig-gen failure, 159 reference-resolution issues (test infra limitation), 1234 skip (source errors). The one real bug: 'namespace global' + class type generates an unparseable signature (FS0010). Marked as Skip for tracking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Swept 1483 standalone .fs files using local fsc with full BCL refs. Results: 274 pass, 6 legit failures, 4 negative-test (excluded), 4 namespace-global (known), 2 infra, 1188 skip. The 6 legit failures in positive test code: - pos36-srtp-lib: SRTP multi-witness constraint lost (FS0340) - pos35: SRTP constraint mismatch (FS0340) - pos34: type application syntax error in sig (FS0010) - pos16: unexpected identifier in value sig (FS0010) - pos08: member missing from sig (FS0193) - fsfromfsviacs/lib: DU base type mismatch (FS0300) Added 3 representative skipped tests covering distinct bug categories. Negative tests (neg*.fs) excluded — broken code is not expected to produce valid signatures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
For single-case struct DUs like [<Struct>] type U0 = U0, the bar prefix changes the base type semantics (FS0300). Only omit the bar for single-case unions when the type is a struct. Non-struct single-case unions keep the bar to avoid parse errors in edge cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Active pattern case names containing spaces were rendered without backtick escaping in generated signatures, producing unparseable output. Fix: in ConvertValLogicalNameToDisplayNameCore, split active pattern names on bar, backtick-escape each case name that is not a valid identifier, rejoin. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Type parameters with names containing angle brackets (e.g. Monad<'T> from SRTP) are now backtick-escaped in layoutTyparRef using NormalizeIdentifierBackticks. This prevents parse errors when such type params appear in generated signatures via GenerateSignature. Note: the --sig flag uses a separate code path (SignatureWriter) that is not fixed by this change. Only the FCS GenerateSignature API path benefits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
In GenerateSignature, detect when the typed tree has types directly at root level (TMDefRec with tycons, not wrapped in a Module binding) and prepend 'namespace global' to the layout output. Simple case (types only) roundtrips. Complex case (types + nested module) needs further layout investigation and is tracked as skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generated sig text is CORRECT (fsc --sig roundtrips fine). The failure is specific to the FCS Compile API path used by the test infrastructure. This is an FCS conformance issue, not a sig generation bug. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ures For inline functions/members with statically resolved type parameters, use explicit type param declarations (M< ^T when constraint >) instead of postfix constraints (M: ... when constraint). The postfix form is not accepted by the conformance checker for SRTP constraints. Changes: - layoutMemberName: trigger layoutTyparDecls when SRTP typars present - prettyLayoutOfValOrMemberNoInst: same for module-level vals - prettyLayoutOfCurriedMemberSig: exclude SRTP typar constraints from postfix position when they're on explicit type param declarations - Operator names excluded (can't have explicit type params in .fsi) - Updated baseline for type extension SRTP test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify that tooltip/quickinfo display is correct after sig-gen fixes: - Backticked active pattern case names preserved in tooltip - SRTP inline function type params displayed with requires clause - Single-case struct DU displayed without bar prefix - Inline function type params shown properly These tests explicitly cover the display-layer leaks identified by the isolation audit, confirming all are improvements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…fra) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Roundtrip fails: member M(()) generates sig 'member M: unit -> unit' but conformance checker can't match it when M is overloaded. Proven NOT FCS-specific: fsc CLI also fails when .fsi/.fs are paired. The sig text is correct; the bug is in SignatureConformance matching for unit-parameter overloads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move namespace global detection from FSharpCheckerResults.fs into NicePrint.layoutImpliedSignatureOfModuleOrNamespace so all callers (FCS API, fsc --sig, FSI) benefit - Fix module rendering inside namespace global: modules were rendered without '=' and indentation because empty outerPath was treated as standalone module. Now check isGlobalNamespace flag. - Unskip pos34 (type application) and pos16 (multi-case AP) tests — already fixed by SRTP and backtick escaping changes - Unskip namespace global + nested module test — now fixed Remaining skip: #19596 (unit param overload conformance bug) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2cfd821 to
36ba04a
Compare
Contributor
✅ No release notes required |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
95a197e to
5570959
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 19, 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.
Follow-up to #19586. Corpus-wide roundtrip sweep of 1,483 standalone test files found additional bugs where generated signatures fail to compile with their source.
Fixes #19592
Fixes #19593
Fixes #19594
Fixes #19595
Fixes #19597
Notable:
namespace globaldetection moved fromFSharpCheckerResults.fsintoNicePrint.layoutImpliedSignatureOfModuleOrNamespace— now works forfsc --sigpath too, not just FCS API.Display changes in NicePrint/PrettyNaming leak to tooltips — all improvements, covered by 4 new tooltip tests (37 pass, 0 regressions).