zzarchive-VisualFSharpPowerTools icon indicating copy to clipboard operation
zzarchive-VisualFSharpPowerTools copied to clipboard

[Find all references] It considers nested functions / APs as public

Open vasily-kirichenko opened this issue 9 years ago • 6 comments

let f x =
  let (|PA|_|) x = Some x
  x
  • Execute "Find all refs" on '(|PA|_|)`
  • It searches in current and all dependent projects

As it should work: it searches inside current file only.

vasily-kirichenko avatar Feb 16 '16 07:02 vasily-kirichenko

I've investigated the issue and it's turned out it's impossible to determine whether an active pattern is defined on module level or inside a function/method. When user launches Find all refs on a active pattern, type of the Symbol is FSharpActivePatternCase which does not have any information in which scope/context it's defined.

vasily-kirichenko avatar Feb 27 '16 15:02 vasily-kirichenko

Could it be done via .Group.EnclosingEntity? Then one can check the kind of entity it is (module or function, etc.) or check accessibility of the enclosing entity.

dungpa avatar Feb 27 '16 19:02 dungpa

Yeah, I also thought so, but EnclosingEntity is null :(

vasily-kirichenko avatar Feb 27 '16 19:02 vasily-kirichenko

...for a local PA. will check if it exists for module level ones.

vasily-kirichenko avatar Feb 28 '16 06:02 vasily-kirichenko

Checked it - no, EncrosingEntity is null even for module level PAs :(

vasily-kirichenko avatar Feb 28 '16 07:02 vasily-kirichenko

The situation sounds familiar :). I think it might work for APs at declarations but not at call sites, which is not adequate.

dungpa avatar Mar 02 '16 11:03 dungpa