File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -2252,7 +2252,7 @@ end
22522252Checks that a package entry file `srcpath` has a module declaration, and that it is before any using/import statements.
22532253"""
22542254function check_src_module_wrap (pkg:: PkgId , srcpath:: String )
2255- module_rgx = r" ^ \s *(?:@\w *\s *)*(?:bare)?module\s "
2255+ module_rgx = r" \s *(?:@\w *\s *)*(?:bare)?module\s "
22562256 load_rgx = r" \b (?:using|import)\s "
22572257 load_seen = false
22582258 inside_string = false
@@ -2262,7 +2262,7 @@ function check_src_module_wrap(pkg::PkgId, srcpath::String)
22622262 inside_string = ! inside_string
22632263 end
22642264 inside_string && continue
2265- if startswith (s, module_rgx)
2265+ if contains (s, module_rgx)
22662266 if load_seen
22672267 throw (ErrorException (" Package $pkg source file $srcpath has a using/import before a module declaration." ))
22682268 end
Original file line number Diff line number Diff line change @@ -1222,6 +1222,24 @@ end
12221222 """ )
12231223 @test Base. check_src_module_wrap (p, fpath)
12241224
1225+ write (fpath, """
1226+ \"\"\"
1227+ Foo
1228+ \"\"\" module Foo
1229+ using Bar
1230+ end
1231+ """ )
1232+ @test Base. check_src_module_wrap (p, fpath)
1233+
1234+ write (fpath, """
1235+ @doc let x = 1
1236+ x
1237+ end module Foo
1238+ using Bar
1239+ end
1240+ """ )
1241+ @test Base. check_src_module_wrap (p, fpath)
1242+
12251243 write (fpath, """
12261244 # using foo
12271245 module Foo
You can’t perform that action at this time.
0 commit comments