Commit e549b7f
committed
constrain the path argument of
Each `Module` defined with `module` automatically gets an `include`
function with two methods. Each of those two methods takes a file path
as its last argument. Even though the path argument is unconstrained by
dispatch, it's documented as constrained with `::AbstractString`:
https://docs.julialang.org/en/v1.11-dev/base/base/#include
Furthermore, I think that any invocation of `include` with a
non-`AbstractString` path will necessarily throw a `MethodError`
eventually. Thus this change should be harmless.
Adding the type constraint to the path argument is an improvement
because any possible exception would be thrown earlier than before.
Apart from modules defined with `module`, the same issue is present
with the anonymous modules created by `evalfile`, which is also
addressed.
Sidenote: `evalfile` seems to be completely untested apart from the
test added here.include functions to AbstractString
1 parent 2e1235e commit e549b7f
File tree
4 files changed
+16
-4
lines changed- base
- src
- test
- testhelpers
4 files changed
+16
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2715 | 2715 | | |
2716 | 2716 | | |
2717 | 2717 | | |
2718 | | - | |
2719 | | - | |
| 2718 | + | |
| 2719 | + | |
2720 | 2720 | | |
2721 | 2721 | | |
2722 | 2722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
796 | 807 | | |
797 | 808 | | |
798 | 809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments