@@ -155,8 +155,24 @@ let rec pathEq p1 p2 =
155155| PathEmpty(_), PathEmpty(_) -> true
156156| _ -> false
157157
158- //// (Temporarily copy-pasted from TypeChecker.fs)
159- let TcFieldInit lit =
158+
159+ //---------------------------------------------------------------------------
160+ // Counter example generation
161+ //---------------------------------------------------------------------------
162+
163+ type RefutedSet =
164+ /// A value RefutedInvestigation(path,discrim) indicates that the value at the given path is known
165+ /// to NOT be matched by the given discriminator
166+ | RefutedInvestigationof Path * DecisionTreeTest list
167+ /// A value RefutedWhenClause indicates that a 'when' clause failed
168+ | RefutedWhenClause
169+
170+ let notNullText = " some-non-null-value"
171+ let otherSubtypeText = " some-other-subtype"
172+
173+ /// Create a TAST const value from an IL-initialized field read from .NET metadata
174+ // (Originally moved from TcFieldInit in TypeChecker.fs -- feel free to move this somewhere more appropriate)
175+ let ilFieldToTastConst lit =
160176match litwith
161177| ILFieldInit.String s-> Const.String s
162178| ILFieldInit.Null-> Const.Zero
@@ -173,21 +189,6 @@ let TcFieldInit lit =
173189| ILFieldInit.Single f-> Const.Single f
174190| ILFieldInit.Double f-> Const.Double f
175191
176-
177- //---------------------------------------------------------------------------
178- // Counter example generation
179- //---------------------------------------------------------------------------
180-
181- type RefutedSet =
182- /// A value RefutedInvestigation(path,discrim) indicates that the value at the given path is known
183- /// to NOT be matched by the given discriminator
184- | RefutedInvestigationof Path * DecisionTreeTest list
185- /// A value RefutedWhenClause indicates that a 'when' clause failed
186- | RefutedWhenClause
187-
188- let notNullText = " some-non-null-value"
189- let otherSubtypeText = " some-other-subtype"
190-
191192exception CannotRefute
192193let RefuteDiscrimSet g m path discrims =
193194let mkUnknown ty = snd( mkCompGenLocal m" _" ty)
@@ -264,7 +265,7 @@ let RefuteDiscrimSet g m path discrims =
264265|> Seq.choose( fun ilField ->
265266if ilField.IsStaticthen
266267 ilField.LiteralValue|> Option.map( fun ilValue ->
267- ilField.Name, TcFieldInit ilValue)
268+ ilField.Name, ilFieldToTastConst ilValue)
268269else None)
269270else
270271 tcref.AllFieldsArray|> Seq.choose( fun fsField ->