@@ -4419,10 +4419,15 @@ module Project36 =
4419
4419
let dllName = Path.ChangeExtension( base2, " .dll" )
4420
4420
let projFileName = Path.ChangeExtension( base2, " .fsproj" )
4421
4421
let fileSource1 = """
4422
+ type A(i:int) =
4423
+ member x.Value = i
4424
+
4422
4425
type B(i:int) as b =
4426
+ inherit A(i*2)
4423
4427
let a = b.Overload(i)
4424
4428
member x.Overload() = a
4425
4429
member x.Overload(y: int) = y + y
4430
+ member x.BaseValue = base.Value
4426
4431
4427
4432
let [<Literal>] lit = 1.0
4428
4433
let notLit = 1.0
@@ -4449,21 +4454,35 @@ let callToOverload = B(5).Overload(4)
4449
4454
| FSharpImplementationFileDeclaration.InitAction e -> e
4450
4455
| _ -> failwith " unexpected declaration"
4451
4456
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
+
4452
4467
[<Test>]
4453
4468
let ``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
4455
4474
| BasicPatterns.Let(( b,_),_) ->
4456
4475
b.IsConstructorThisValue && not b.IsMemberThisValue
4457
4476
| _ -> failwith " unexpected expression"
4458
4477
|> shouldEqual true
4459
4478
4460
- match Project36.getExpr 2 with
4479
+ match Project36.getExpr 5 with
4461
4480
| BasicPatterns.FSharpFieldGet( Some( BasicPatterns.Value x),_,_) ->
4462
4481
x.IsMemberThisValue && not x.IsConstructorThisValue
4463
4482
| _ -> failwith " unexpected expression"
4464
4483
|> shouldEqual true
4465
4484
4466
- match Project36.getExpr 3 with
4485
+ match Project36.getExpr 6 with
4467
4486
| BasicPatterns.Call(_,_,_,_,[ BasicPatterns.Value s;_]) ->
4468
4487
not s.IsMemberThisValue && not s.IsConstructorThisValue
4469
4488
| _ -> failwith " unexpected expression"
0 commit comments