Skip to content
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

Setting enum supertype fails #9

Open
christopher-dG opened this issue May 28, 2020 · 0 comments · May be fixed by #10
Open

Setting enum supertype fails #9

christopher-dG opened this issue May 28, 2020 · 0 comments · May be fixed by #10

Comments

@christopher-dG
Copy link

julia> @se Foo::Int64 a b c
ERROR: TypeError: in module, expected Symbol, got Expr
Stacktrace:
 [1] eval(::Module, ::Any) at ./boot.jl:331
 [2] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [3] run_backend(::REPL.REPLBackend) at /home/degraafc/.local/share/julia/packages/Revise/jVsKo/src/Revise.jl:1023
 [4] top-level scope at none:0

Here's the macroexpand:

julia> @macroexpand1 @se Foo::Int64 a b c
:($(Expr(:toplevel, :(#= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:152 =#), :(module Foo::Int64
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:152 =#
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:155 =#
  primitive type Foo <: SuperEnum.Enum{Int64} 64 end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:156 =#
  function Foo(var"#72#x"::SuperEnum.Integer)
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:157 =#
      (0 SuperEnum.:<= var"#72#x" SuperEnum.:<= 2) || SuperEnum.enum_argument_error(:Foo, var"#72#x")
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:158 =#
      return SuperEnum.bitcast(Foo, SuperEnum.convert(Int64, var"#72#x"))
  end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:160 =#
  (SuperEnum.SuperEnum).basetype(::SuperEnum.Type{Foo}) = begin
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:160 =#
          Int64
      end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:161 =#
  (SuperEnum.Base).typemin(var"#74#x"::SuperEnum.Type{Foo}) = begin
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:161 =#
          Foo(0)
      end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:162 =#
  (SuperEnum.Base).typemax(var"#75#x"::SuperEnum.Type{Foo}) = begin
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:162 =#
          Foo(2)
      end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:163 =#
  (SuperEnum.Base).isless(var"#76#x"::Foo, var"#77#y"::Foo) = begin
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:163 =#
          SuperEnum.isless((Int64)(var"#76#x"), (Int64)(var"#77#y"))
      end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:164 =#
  let var"#71#insts" = SuperEnum.ntuple((var"#80#i"->begin
                      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:164 =#
                      Foo(([0, 1, 2])[var"#80#i"])
                  end), 3)
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:165 =#
      (SuperEnum.Base).instances(::SuperEnum.Type{Foo}) = begin
              #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:165 =#
              var"#71#insts"
          end
  end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:167 =#
  function (SuperEnum.Base).string(var"#84#x"::Foo)
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:168 =#
      for (var"#81#sym", var"#82#i", var"#83#str") = Tuple{Symbol,Integer,String}[(:a, 0, "a"), (:b, 1, "b"), (:c, 2, "c")]
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:169 =#
          if var"#82#i" == (Int64)(var"#84#x")
              #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:170 =#
              return var"#83#str"
          end
      end
  end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:174 =#
  function (SuperEnum.Base).print(var"#88#io"::SuperEnum.IO, var"#89#x"::Foo)
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:175 =#
      for (var"#85#sym", var"#86#i", var"#87#str") = Tuple{Symbol,Integer,String}[(:a, 0, "a"), (:b, 1, "b"), (:c, 2, "c")]
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:176 =#
          if var"#86#i" == (Int64)(var"#89#x")
              #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:177 =#
              (SuperEnum.Base).print(var"#88#io", var"#85#sym")
              #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:177 =#
              break
          end
      end
  end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:181 =#
  function (SuperEnum.Base).show(var"#90#io"::SuperEnum.IO, var"#91#x"::Foo)
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:182 =#
      if SuperEnum.get(var"#90#io", :compact, false)
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:183 =#
          SuperEnum.print(var"#90#io", var"#91#x")
      else
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:185 =#
          SuperEnum.print(var"#90#io", var"#91#x", "::")
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:186 =#
          SuperEnum.show(SuperEnum.IOContext(var"#90#io", :compact => true), SuperEnum.typeof(var"#91#x"))
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:187 =#
          SuperEnum.print(var"#90#io", " = ")
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:188 =#
          SuperEnum.show(var"#90#io", (Int64)(var"#91#x"))
      end
  end
  #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:191 =#
  function (SuperEnum.Base).show(var"#94#io"::SuperEnum.IO, ::MIME"text/plain", var"#96#t"::SuperEnum.Type{Foo})
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:192 =#
      SuperEnum.print(var"#94#io", "Enum ")
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:193 =#
      (SuperEnum.Base).show_datatype(var"#94#io", var"#96#t")
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:194 =#
      SuperEnum.print(var"#94#io", ":")
      #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:195 =#
      for (var"#92#sym", var"#93#i") = Tuple{Symbol,Integer,String}[(:a, 0, "a"), (:b, 1, "b"), (:c, 2, "c")]
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:196 =#
          SuperEnum.print(var"#94#io", "\n", var"#92#sym", " = ")
          #= /home/degraafc/.local/share/julia/packages/SuperEnum/vsEWn/src/SuperEnum.jl:197 =#
          SuperEnum.show(var"#94#io", var"#93#i")
      end
  end
  const a = Foo(0)
  export a
  const b = Foo(1)
  export b
  const c = Foo(2)
  export c
  end))))
@christopher-dG christopher-dG linked a pull request May 28, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant