forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// #Regression #Conformance #PatternMatching #ActivePatterns | ||
// Regression test for https://github.com/Microsoft/visualfsharp/issues/5745 | ||
//<Expects status="error id="FS3174">Active patterns do not have 1fields. This syntax is invalid\.</Expects> | ||
open System.Text.RegularExpressions | ||
|
||
let (|USZipPlus4Code|_|) s = | ||
let m = Regex.Match(s, @"^(\d{5})\-(\d{4})$") | ||
if m.Success then | ||
USZipPlus4Code(x=m.Groups.[1].Value, | ||
y=m.Groups.[2].Value) | ||
|> Some | ||
else | ||
None |
This file contains 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