-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to hide type annotations (#234)
* add option to hide type annotations The motivating case here is that Diffractor often generates complex and deeply nested lattice elements, so hiding them can make the code easier to read. * fix toggle * improve coverage
- Loading branch information
1 parent
ba4a116
commit cecf599
Showing
70 changed files
with
929 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/test_output/foo-opt-compact-nowarn-hide_type_stable-inline_cost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
│ ─ %-1 = invoke foo(::Int64,::Int64)::Any | ||
[90m[72G││[1G[39m[90m [39m[0m│ [32m 0[39m %2 = %new(%1) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─[32m 0[39m %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─[32m 0[39m %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 20[39m %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄[32m 0[39m %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ [32m 1000[39m %31 = (%20 + %30) | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/test_output/foo-opt-compact-nowarn-hide_type_stable-nocost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
│ ─ %-1 = invoke foo(::Int64,::Int64)::Any | ||
[90m[72G││[1G[39m[90m [39m[0m│ %2 = %new(%1) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─ %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─ %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄ %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ %31 = (%20 + %30) | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
test/test_output/foo-opt-compact-nowarn-show_type_stable-inline_cost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
│ ─ %-1 = invoke foo(::Int64,::Int64)::Any | ||
[90m[72G│╻ Box[1G[39m[90m2 [39m[0m1 ──[32m 0[39m %1 = Core.Box | ||
[90m[72G││[1G[39m[90m [39m[0m│ [32m 0[39m %2 = %new(%1) | ||
[90m[72G│╻ +[1G[39m[90m [39m[0m│ [32m 1[39m %3 = Base.add_int(_2, _3) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 3[39m Core.setfield!(%2, :contents, %3) | ||
[90m[72G│ [1G[39m[90m3 [39m[0m│ [32m 1[39m %5 = Core.isdefined(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #3 if not %5 | ||
[90m[72G│ [1G[39m[90m [39m[0m2 ──[32m 0[39m goto #4 | ||
[90m[72G│ [1G[39m[90m [39m[0m3 ──[32m 0[39m $(Expr(:throw_undef_if_not, :z, false)) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─[32m 0[39m %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #9 if not %10 | ||
[90m[72G│ [1G[39m[90m4 [39m[0m5 ──[32m 1[39m %12 = Core.isdefined(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #7 if not %12 | ||
[90m[72G│ [1G[39m[90m [39m[0m6 ──[32m 0[39m goto #8 | ||
[90m[72G│ [1G[39m[90m [39m[0m7 ──[32m 0[39m $(Expr(:throw_undef_if_not, :z, false)) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─[32m 0[39m %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 3[39m Core.setfield!(%2, :contents, %17) | ||
[90m[72G│ [1G[39m[90m6 [39m[0m9 ┄─[32m 0[39m %19 = %new(Main.anonymous.:(var"#1#2"), %2) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 20[39m %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m7 [39m[0m│ [32m 1[39m %21 = (isa)(_2, Missing) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #11 if not %21 | ||
[90m[72G│ [1G[39m[90m [39m[0m10 ─[32m 0[39m goto #14 | ||
[90m[72G│ [1G[39m[90m [39m[0m11 ─[32m 1[39m %24 = (isa)(_2, Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #13 if not %24 | ||
[90m[72G│╻ +[1G[39m[90m [39m[0m12 ─[32m 1[39m %26 = Base.add_int(_2, _3) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m goto #14 | ||
[90m[72G│ [1G[39m[90m [39m[0m13 ─[32m 0[39m Core.throw(ErrorException("fatal error in type inference (type bound)")) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m unreachable | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄[32m 0[39m %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ [32m 1000[39m %31 = (%20 + %30) | ||
[90m[72G│ [1G[39m[90m [39m[0m└───[32m 0[39m return %31 | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
test/test_output/foo-opt-compact-nowarn-show_type_stable-nocost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
│ ─ %-1 = invoke foo(::Int64,::Int64)::Any | ||
[90m[72G│╻ Box[1G[39m[90m2 [39m[0m1 ── %1 = Core.Box | ||
[90m[72G││[1G[39m[90m [39m[0m│ %2 = %new(%1) | ||
[90m[72G│╻ +[1G[39m[90m [39m[0m│ %3 = Base.add_int(_2, _3) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ Core.setfield!(%2, :contents, %3) | ||
[90m[72G│ [1G[39m[90m3 [39m[0m│ %5 = Core.isdefined(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #3 if not %5 | ||
[90m[72G│ [1G[39m[90m [39m[0m2 ── goto #4 | ||
[90m[72G│ [1G[39m[90m [39m[0m3 ── $(Expr(:throw_undef_if_not, :z, false)) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─ %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #9 if not %10 | ||
[90m[72G│ [1G[39m[90m4 [39m[0m5 ── %12 = Core.isdefined(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #7 if not %12 | ||
[90m[72G│ [1G[39m[90m [39m[0m6 ── goto #8 | ||
[90m[72G│ [1G[39m[90m [39m[0m7 ── $(Expr(:throw_undef_if_not, :z, false)) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─ %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── Core.setfield!(%2, :contents, %17) | ||
[90m[72G│ [1G[39m[90m6 [39m[0m9 ┄─ %19 = %new(Main.anonymous.:(var"#1#2"), %2) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m7 [39m[0m│ %21 = (isa)(_2, Missing) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #11 if not %21 | ||
[90m[72G│ [1G[39m[90m [39m[0m10 ─ goto #14 | ||
[90m[72G│ [1G[39m[90m [39m[0m11 ─ %24 = (isa)(_2, Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #13 if not %24 | ||
[90m[72G│╻ +[1G[39m[90m [39m[0m12 ─ %26 = Base.add_int(_2, _3) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── goto #14 | ||
[90m[72G│ [1G[39m[90m [39m[0m13 ─ Core.throw(ErrorException("fatal error in type inference (type bound)")) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── unreachable | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄ %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ %31 = (%20 + %30) | ||
[90m[72G│ [1G[39m[90m [39m[0m└─── return %31 | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/test_output/foo-opt-compact-warn-hide_type_stable-inline_cost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Body[91m[1m::Any[22m[39m | ||
[90m[72G││[1G[39m[90m [39m[0m│ [32m 0[39m %2 = %new(%1) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─[32m 0[39m %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─[32m 0[39m %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 1000[39m %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ [32m 20[39m %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄[32m 0[39m %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ [32m 1000[39m %31 = (%20 + %30) | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/test_output/foo-opt-compact-warn-hide_type_stable-nocost-notypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Body[91m[1m::Any[22m[39m | ||
[90m[72G││[1G[39m[90m [39m[0m│ %2 = %new(%1) | ||
[90m[72G│ [1G[39m[90m [39m[0m4 ┄─ %9 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %10 = (%9 < 4) | ||
[90m[72G│ [1G[39m[90m [39m[0m8 ┄─ %16 = Core.getfield(%2, :contents) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %17 = (%16 + 1) | ||
[90m[72G│ [1G[39m[90m [39m[0m│ %20 = invoke %19(_2::Int64) | ||
[90m[72G│ [1G[39m[90m [39m[0m14 ┄ %30 = φ (#10 => $(QuoteNode(missing)), #12 => %26) | ||
[90m[72G│ [1G[39m[90m8 [39m[0m│ %31 = (%20 + %30) | ||
[90m[72G [1G[39m[90m [39m |
File renamed without changes.
Oops, something went wrong.