@@ -4419,10 +4419,15 @@ module Project36 =
44194419 let dllName = Path.ChangeExtension( base2, " .dll" )
44204420 let projFileName = Path.ChangeExtension( base2, " .fsproj" )
44214421 let fileSource1 = """
4422+ type A(i:int) =
4423+ member x.Value = i
4424+
44224425type B(i:int) as b =
4426+ inherit A(i*2)
44234427 let a = b.Overload(i)
44244428 member x.Overload() = a
44254429 member x.Overload(y: int) = y + y
4430+ member x.BaseValue = base.Value
44264431
44274432let [<Literal>] lit = 1.0
44284433let notLit = 1.0
@@ -4449,21 +4454,35 @@ let callToOverload = B(5).Overload(4)
44494454 | FSharpImplementationFileDeclaration.InitAction e -> e
44504455 | _ -> failwith " unexpected declaration"
44514456
4457+ [<Test>]
4458+ let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` () =
4459+ Project36.wholeProjectResults.GetAllUsesOfAllSymbols()
4460+ |> Async.RunSynchronously
4461+ |> Array.pick ( fun ( su : FSharpSymbolUse ) ->
4462+ if su.Symbol.DisplayName = " base"
4463+ then Some ( su.Symbol :?> FSharpMemberOrFunctionOrValue)
4464+ else None)
4465+ |> fun baseSymbol -> shouldEqual true baseSymbol.IsBaseValue
4466+
44524467[<Test>]
44534468let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMemberThisValue`` () =
4454- match Project36.getExpr 1 with
4469+ // Instead of checking the symbol uses directly, walk the typed tree to check
4470+ // the correct values are also visible from there. Also note you cannot use
4471+ // BasicPatterns.ThisValue in these cases, this is only used when the symbol
4472+ // is implicit in the constructor
4473+ match Project36.getExpr 4 with
44554474 | BasicPatterns.Let(( b,_),_) ->
44564475 b.IsConstructorThisValue && not b.IsMemberThisValue
44574476 | _ -> failwith " unexpected expression"
44584477 |> shouldEqual true
44594478
4460- match Project36.getExpr 2 with
4479+ match Project36.getExpr 5 with
44614480 | BasicPatterns.FSharpFieldGet( Some( BasicPatterns.Value x),_,_) ->
44624481 x.IsMemberThisValue && not x.IsConstructorThisValue
44634482 | _ -> failwith " unexpected expression"
44644483 |> shouldEqual true
44654484
4466- match Project36.getExpr 3 with
4485+ match Project36.getExpr 6 with
44674486 | BasicPatterns.Call(_,_,_,_,[ BasicPatterns.Value s;_]) ->
44684487 not s.IsMemberThisValue && not s.IsConstructorThisValue
44694488 | _ -> failwith " unexpected expression"
0 commit comments