-
Notifications
You must be signed in to change notification settings - Fork 789
/
PatternMatchCompilation.fsi
78 lines (66 loc) · 2.57 KB
/
PatternMatchCompilation.fsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
module internal FSharp.Compiler.PatternMatchCompilation
open FSharp.Compiler
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.InfoReader
open FSharp.Compiler.Syntax.PrettyNaming
open FSharp.Compiler.TcGlobals
open FSharp.Compiler.Text
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TypedTreeOps
/// What should the decision tree contain for any incomplete match?
type ActionOnFailure =
| ThrowIncompleteMatchException
| IgnoreWithWarning
| Throw
| Rethrow
| FailFilter
/// Represents the typechecked, elaborated form of a pattern, prior to pattern-match compilation.
[<NoEquality; NoComparison>]
type Pattern =
| TPat_const of Const * range
| TPat_wild of range
| TPat_as of Pattern * PatternValBinding * range
| TPat_disjs of Pattern list * range
| TPat_conjs of Pattern list * range
| TPat_query of
(Expr * TType list * ActivePatternReturnKind * (ValRef * TypeInst) option * int * ActivePatternInfo) *
Pattern *
range
| TPat_unioncase of UnionCaseRef * TypeInst * Pattern list * range
| TPat_exnconstr of TyconRef * Pattern list * range
| TPat_tuple of TupInfo * Pattern list * TType list * range
| TPat_array of Pattern list * TType * range
| TPat_recd of TyconRef * TypeInst * Pattern list * range
| TPat_null of range
| TPat_isinst of TType * TType * Pattern option * range
| TPat_error of range
member Range: range
and PatternValBinding = PatternValBinding of Val * GeneralizedType
and MatchClause = MatchClause of Pattern * Expr option * DecisionTreeTarget * range
val ilFieldToTastConst: ILFieldInit -> Const
/// Compile a pattern into a decision tree and a set of targets.
val internal CompilePattern:
TcGlobals ->
DisplayEnv ->
Import.ImportMap ->
(ValRef -> ValUseFlag -> TTypes -> range -> Expr * TType) ->
InfoReader ->
// range of the expression we are matching on
range ->
// range to report "incomplete match" on
range ->
// warn on unused?
bool ->
ActionOnFailure ->
Val * Typars * Expr option ->
// input type-checked syntax of pattern matching
MatchClause list ->
// input type
TType ->
// result type
TType ->
DecisionTree * DecisionTreeTarget list
exception internal MatchIncomplete of bool * (string * bool) option * range
exception internal RuleNeverMatched of range
exception internal EnumMatchIncomplete of bool * (string * bool) option * range