Skip to content

Commit 742e6de

Browse files
committed
Only a top level auto open should always be considered as a dependency.
1 parent 87725ff commit 742e6de

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

tests/ParallelTypeCheckingTests/Code/TrieApproach/AutoOpenDetection.fs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let private autoOpenShapes =
1616
/// This isn't bullet proof but I wonder who would really alias this very core attribute.
1717
let isAutoOpenAttribute (attribute: SynAttribute) =
1818
match attribute.ArgExpr with
19-
| SynExpr.Const(constant = SynConst.Unit _)
19+
| SynExpr.Const(constant = SynConst.Unit)
2020
| SynExpr.Const(constant = SynConst.String _)
2121
| SynExpr.Paren(expr = SynExpr.Const(constant = SynConst.String _)) ->
2222
let attributeName =
@@ -30,31 +30,12 @@ let isAutoOpenAttribute (attribute: SynAttribute) =
3030
let isAnyAttributeAutoOpen (attributes: SynAttributes) =
3131
List.exists (fun (atl: SynAttributeList) -> List.exists isAutoOpenAttribute atl.Attributes) attributes
3232

33-
let rec hasNestedModuleWithAutoOpenAttribute (decls: SynModuleDecl list) : bool =
34-
decls
35-
|> List.exists (function
36-
| SynModuleDecl.NestedModule (moduleInfo = SynComponentInfo (attributes = attributes); decls = decls) ->
37-
isAnyAttributeAutoOpen attributes || hasNestedModuleWithAutoOpenAttribute decls
38-
| _ -> false)
39-
40-
let rec hasNestedSigModuleWithAutoOpenAttribute (decls: SynModuleSigDecl list) : bool =
41-
decls
42-
|> List.exists (function
43-
| SynModuleSigDecl.NestedModule (moduleInfo = SynComponentInfo (attributes = attributes); moduleDecls = decls) ->
44-
isAnyAttributeAutoOpen attributes
45-
|| hasNestedSigModuleWithAutoOpenAttribute decls
46-
| _ -> false)
47-
4833
let hasAutoOpenAttributeInFile (ast: ParsedInput) : bool =
4934
match ast with
5035
| ParsedInput.SigFile (ParsedSigFileInput (contents = contents)) ->
51-
contents
52-
|> List.exists (fun (SynModuleOrNamespaceSig (attribs = attribs; decls = decls)) ->
53-
isAnyAttributeAutoOpen attribs || hasNestedSigModuleWithAutoOpenAttribute decls)
36+
List.exists (fun (SynModuleOrNamespaceSig (attribs = attribs)) -> isAnyAttributeAutoOpen attribs) contents
5437
| ParsedInput.ImplFile (ParsedImplFileInput (contents = contents)) ->
55-
contents
56-
|> List.exists (fun (SynModuleOrNamespace (attribs = attribs; decls = decls)) ->
57-
isAnyAttributeAutoOpen attribs || hasNestedModuleWithAutoOpenAttribute decls)
38+
List.exists (fun (SynModuleOrNamespace (attribs = attribs)) -> isAnyAttributeAutoOpen attribs) contents
5839

5940
// ==============================================================================================================================
6041
// ==============================================================================================================================

0 commit comments

Comments
 (0)