@@ -4442,44 +4442,38 @@ let callToOverload = B(5).Overload(4)
4442
4442
let checkedFile = wholeProjectResults.AssemblyContents.ImplementationFiles.[ 0 ]
4443
4443
match checkedFile.Declarations.[ 0 ] with
4444
4444
| FSharpImplementationFileDeclaration.Entity (_, subDecls) -> subDecls
4445
- | _ -> failwith " unexpected"
4445
+ | _ -> failwith " unexpected declaration "
4446
4446
let getExpr exprIndex =
4447
4447
match declarations.[ exprIndex] with
4448
4448
| FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(_,_, e) -> e
4449
4449
| FSharpImplementationFileDeclaration.InitAction e -> e
4450
- | _ -> failwith " unexpected"
4450
+ | _ -> failwith " unexpected declaration "
4451
4451
4452
4452
[<Test>]
4453
- let ``Test project36 FSharpMemberOrFunctionOrValue properties `` () =
4453
+ let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMemberThisValue `` () =
4454
4454
match Project36.getExpr 1 with
4455
- | BasicPatterns.Let(( b,_),_)
4456
- when b.IsConstructorThisValue && not b.IsMemberThisValue -> ()
4457
- | _ -> failwith " val b in type B constructor must be ConstructorThis"
4455
+ | BasicPatterns.Let(( b,_),_) ->
4456
+ b.IsConstructorThisValue && not b.IsMemberThisValue
4457
+ | _ -> failwith " unexpected expression"
4458
+ |> shouldEqual true
4458
4459
4459
4460
match Project36.getExpr 2 with
4460
- | BasicPatterns.FSharpFieldGet( Some( BasicPatterns.Value x),_,_)
4461
- when x.IsMemberThisValue && not x.IsConstructorThisValue -> ()
4462
- | _ -> failwith " val x in B.Overload() must be MemberThis"
4461
+ | BasicPatterns.FSharpFieldGet( Some( BasicPatterns.Value x),_,_) ->
4462
+ x.IsMemberThisValue && not x.IsConstructorThisValue
4463
+ | _ -> failwith " unexpected expression"
4464
+ |> shouldEqual true
4463
4465
4464
4466
match Project36.getExpr 3 with
4465
- | BasicPatterns.Call(_,_,_,_,[ BasicPatterns.Value s;_])
4466
- when not s.IsMemberThisValue && not s.IsConstructorThisValue -> ()
4467
- | _ -> failwith " val s in B.Overload(s) must not be MemberThis"
4467
+ | BasicPatterns.Call(_,_,_,_,[ BasicPatterns.Value s;_]) ->
4468
+ not s.IsMemberThisValue && not s.IsConstructorThisValue
4469
+ | _ -> failwith " unexpected expression"
4470
+ |> shouldEqual true
4468
4471
4472
+ [<Test>]
4473
+ let ``Test project36 FSharpMemberOrFunctionOrValue.LiteralValue`` () =
4469
4474
let project36Module = Project36.wholeProjectResults.AssemblySignature.Entities.[ 0 ]
4470
4475
let lit = project36Module.MembersFunctionsAndValues.[ 0 ]
4471
- let notLit = project36Module.MembersFunctionsAndValues.[ 1 ]
4472
- if lit.LiteralValue.IsNone || notLit.LiteralValue.IsSome then
4473
- failwith " val lit must be LiteralValue while notLit musn't"
4476
+ shouldEqual true ( lit.LiteralValue.Value |> unbox |> (=) 1. )
4474
4477
4475
- [<Test>]
4476
- let ``Test project36 FSharpMemberOrFunctionOrValue.Overloads ( false ) `` () =
4477
- match Project36.getExpr 6 with
4478
- | BasicPatterns.Call(_, meth,_,_,_) ->
4479
- if meth.Overloads( false ) .IsSome then ()
4480
- else failwithf " Cannot check method %s is overloaded from typed expression" meth.FullName
4481
- | _ -> failwith " unexpected"
4482
-
4483
- let typeB = Project36.wholeProjectResults.AssemblySignature.Entities.[ 0 ]. NestedEntities.[ 0 ]
4484
- if typeB.MembersFunctionsAndValues.[ 2 ]. Overloads( false ) .Value.Count < 2 then
4485
- failwith " type B has two overloaded methods named Overload"
4478
+ let notLit = project36Module.MembersFunctionsAndValues.[ 1 ]
4479
+ shouldEqual true notLit.LiteralValue.IsNone
0 commit comments