- 
                Notifications
    You must be signed in to change notification settings 
- Fork 22
Don't make Test a dependency #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
9083d86
              3101224
              b2c8b3d
              511e8d6
              dcf9c33
              d8301df
              c2e7c6c
              ed6fef6
              8af6db2
              2ef77a1
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -11,8 +11,6 @@ InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" | |
| LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
| MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | ||
| Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
| Requires = "ae029012-a4dd-5104-9daa-d747884805df" | ||
| Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test has to be added to  | ||
|  | ||
| [weakdeps] | ||
| AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" | ||
|  | @@ -37,11 +35,10 @@ IntervalSets = "0.7" | |
| InverseFunctions = "0.1.5" | ||
| MacroTools = "0.5" | ||
| Markdown = "1" | ||
| Requires = "0.5, 1.0" | ||
| StaticArrays = "1" | ||
| StructArrays = "0.6" | ||
| Unitful = "1" | ||
| julia = "1.6" | ||
| julia = "1.10" | ||
|         
                  ChrisRackauckas marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| [extras] | ||
| AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4,50 +4,35 @@ using MacroTools: isstructdef, splitstructdef, postwalk | |
| using InverseFunctions | ||
| using Markdown: Markdown, @md_str, term | ||
|  | ||
| if !isdefined(Base, :get_extension) | ||
| using Requires | ||
| end | ||
|  | ||
|  | ||
| include("setindex.jl") | ||
| include("optics.jl") | ||
| include("getsetall.jl") | ||
| include("sugar.jl") | ||
| include("functionlenses.jl") | ||
| include("testing.jl") | ||
|  | ||
| # always included for now | ||
| include("../ext/AccessorsDatesExt.jl") | ||
| include("../ext/AccessorsLinearAlgebraExt.jl") | ||
| 
      Comment on lines
    
      -19
     to 
      -21
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be kept (unless you want to demote them to weak dependencies as well in this PR). | ||
| include("../ext/AccessorsTestExt.jl") | ||
|  | ||
| function __init__() | ||
| @static if !isdefined(Base, :get_extension) | ||
| @require StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" include("../ext/AccessorsStaticArraysExt.jl") | ||
| end | ||
| if isdefined(Base.Experimental, :register_error_hint) | ||
| Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, kwargs | ||
| if exc.f === insert && argtypes[2] <: Accessors.DynamicIndexLens | ||
| println(io) | ||
| term(io, md""" | ||
| `insert` with a `DynamicIndexLens` is not supported, this can happen when you write | ||
| code such as `@insert a[end] = 1` or `@insert a[begin] = 1` since `end` and `begin` | ||
| are functions of `a`. The reason we do not support these with `insert` is that | ||
| Accessors.jl tries to guarentee that `f(insert(obj, f, val)) == val`, but | ||
| `@insert a[end] = 1` and `@insert a[begin] = 1` will violate that invariant. | ||
|  | ||
| Instead, you can use `first` and `last` directly, e.g. | ||
| ``` | ||
| julia> a = (1, 2, 3, 4) | ||
|  | ||
| julia> @insert last(a) = 5 | ||
| (1, 2, 3, 4, 5) | ||
|  | ||
| julia> @insert first(a) = 0 | ||
| (0, 1, 2, 3, 4) | ||
| ``` | ||
| """) | ||
| end | ||
| Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, kwargs | ||
| if exc.f === insert && argtypes[2] <: Accessors.DynamicIndexLens | ||
| println(io) | ||
| term(io, md""" | ||
| `insert` with a `DynamicIndexLens` is not supported, this can happen when you write | ||
| code such as `@insert a[end] = 1` or `@insert a[begin] = 1` since `end` and `begin` | ||
| are functions of `a`. The reason we do not support these with `insert` is that | ||
| Accessors.jl tries to guarentee that `f(insert(obj, f, val)) == val`, but | ||
| `@insert a[end] = 1` and `@insert a[begin] = 1` will violate that invariant. | ||
|  | ||
| Instead, you can use `first` and `last` directly, e.g. | ||
| ``` | ||
| julia> a = (1, 2, 3, 4) | ||
|  | ||
| julia> @insert last(a) = 5 | ||
| (1, 2, 3, 4, 5) | ||
|  | ||
| julia> @insert first(a) = 0 | ||
| (0, 1, 2, 3, 4) | ||
| ``` | ||
| """) | ||
| end | ||
| end | ||
| end | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.