michalmuskala / jason

A blazing fast JSON parser and generator in pure Elixir.
Other
1.61k stars 169 forks source link

Compiler warnings with Elixir v1.17.0-rc.0 #188

Closed nathany-copia closed 3 months ago

nathany-copia commented 4 months ago

Lots of "single-quoted strings represent charlists" warnings in jason 1.4.1

==> jason
Compiling 10 files (.ex)
    warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
    │
 51 │     collapse_static(List.flatten(["{", elements] ++ '}'))
    │                                                     ~
    │
    └─ lib/codegen.ex:51:53
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 118 │       if byte > 0x7F or byte < 0x1F or byte in '"\\/' do
     │                                                ~
     │
     └─ lib/codegen.ex:118:48
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 104 │       _ in '\s\n\t\r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:104:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 106 │       _ in '0', rest ->
     │            ~
     │
     └─ lib/decoder.ex:106:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 108 │       _ in '123456789', rest ->
     │            ~
     │
     └─ lib/decoder.ex:108:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 110 │       _ in '-', rest ->
     │            ~
     │
     └─ lib/decoder.ex:110:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 112 │       _ in '"', rest ->
     │            ~
     │
     └─ lib/decoder.ex:112:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 114 │       _ in '[', rest ->
     │            ~
     │
     └─ lib/decoder.ex:114:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 116 │       _ in '{', rest ->
     │            ~
     │
     └─ lib/decoder.ex:116:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 118 │       _ in ']', rest ->
     │            ~
     │
     └─ lib/decoder.ex:118:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 120 │       _ in 't', rest ->
     │            ~
     │
     └─ lib/decoder.ex:120:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 127 │       _ in 'f', rest ->
     │            ~
     │
     └─ lib/decoder.ex:127:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 134 │       _ in 'n', rest ->
     │            ~
     │
     └─ lib/decoder.ex:134:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 152 │        when byte in '123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:152:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 167 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:167:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 173 │   defp number(<<e, rest::bits>>, original, skip, stack, decode, len) when e in 'eE' do
     │                                                                                ~
     │
     └─ lib/decoder.ex:173:80
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 187 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:187:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 195 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:195:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 199 │        when e in 'eE' do
     │                  ~
     │
     └─ lib/decoder.ex:199:18
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 210 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:210:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 214 │        when byte in '+-' do
     │                     ~
     │
     └─ lib/decoder.ex:214:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 222 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:222:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 230 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:230:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 241 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:241:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 245 │        when byte in '+-' do
     │                     ~
     │
     └─ lib/decoder.ex:245:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 253 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:253:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 261 │        when byte in '0123456789' do
     │                     ~
     │
     └─ lib/decoder.ex:261:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 279 │   defp number_zero(<<e, rest::bits>>, original, skip, stack, decode, len) when e in 'eE' do
     │                                                                                     ~
     │
     └─ lib/decoder.ex:279:85
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 303 │       _ in '\s\n\t\r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:303:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 305 │       _ in ']', rest ->
     │            ~
     │
     └─ lib/decoder.ex:305:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 309 │       _ in ',', rest ->
     │            ~
     │
     └─ lib/decoder.ex:309:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 327 │       _ in '\s\n\t\r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:327:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 329 │       _ in '}', rest ->
     │            ~
     │
     └─ lib/decoder.ex:329:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 336 │       _ in ',', rest ->
     │            ~
     │
     └─ lib/decoder.ex:336:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 351 │       _ in '\s\n\t\r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:351:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 353 │       _ in '}', rest ->
     │            ~
     │
     └─ lib/decoder.ex:353:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 361 │       _ in '"', rest ->
     │            ~
     │
     └─ lib/decoder.ex:361:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 372 │       _ in '\s\n\t\r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:372:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 374 │       _ in ':', rest ->
     │            ~
     │
     └─ lib/decoder.ex:374:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 388 │       _ in '"', rest ->
     │            ~
     │
     └─ lib/decoder.ex:388:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 392 │       _ in '\\', rest ->
     │            ~
     │
     └─ lib/decoder.ex:392:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 412 │       _ in '"', rest ->
     │            ~
     │
     └─ lib/decoder.ex:412:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [416](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:416) │       _ in '\\', rest ->
     │            ~
     │
     └─ lib/decoder.ex:416:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 436 │       _ in 'b', rest ->
     │            ~
     │
     └─ lib/decoder.ex:436:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 437 │         string(rest, original, skip + 2, stack, decode, [acc | '\b'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:437:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [438](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:438) │       _ in 't', rest ->
     │            ~
     │
     └─ lib/decoder.ex:438:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [439](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:439) │         string(rest, original, skip + 2, stack, decode, [acc | '\t'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:439:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [440](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:440) │       _ in 'n', rest ->
     │            ~
     │
     └─ lib/decoder.ex:440:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [441](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:441) │         string(rest, original, skip + 2, stack, decode, [acc | '\n'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:441:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [442](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:442) │       _ in 'f', rest ->
     │            ~
     │
     └─ lib/decoder.ex:442:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [443](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:443) │         string(rest, original, skip + 2, stack, decode, [acc | '\f'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:443:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [444](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:444) │       _ in 'r', rest ->
     │            ~
     │
     └─ lib/decoder.ex:444:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [445](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:445) │         string(rest, original, skip + 2, stack, decode, [acc | '\r'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:445:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [446](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:446) │       _ in '"', rest ->
     │            ~
     │
     └─ lib/decoder.ex:446:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [447](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:447) │         string(rest, original, skip + 2, stack, decode, [acc | '\"'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:447:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [448](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:448) │       _ in '/', rest ->
     │            ~
     │
     └─ lib/decoder.ex:448:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [449](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:449) │         string(rest, original, skip + 2, stack, decode, [acc | '/'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:449:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [450](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:450) │       _ in '\\', rest ->
     │            ~
     │
     └─ lib/decoder.ex:450:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [451](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:451) │         string(rest, original, skip + 2, stack, decode, [acc | '\\'], 0)
     │                                                                ~
     │
     └─ lib/decoder.ex:451:64
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 [452](https://github.com/copia-wealth-studios/copia-server/actions/runs/9258921128/job/25469877879?pr=4203#step:11:452) │       _ in 'u', rest ->
     │            ~
     │
     └─ lib/decoder.ex:452:12
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 609 │       digits1 = 'Dd'
     │                 ~
     │
     └─ lib/decoder.ex:609:17
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 695 │        when byte in '\s\n\r\t' do
     │                     ~
     │
     └─ lib/decoder.ex:695:21
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 164 │     ']'
     │     ~
     │
     └─ lib/encode.ex:164:5
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 193 │     '}'
     │     ~
     │
     └─ lib/encode.ex:193:5
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 211 │     '}'
     │     ~
     │
     └─ lib/encode.ex:211:5
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 284 │   slash_escapes = Enum.zip('\b\t\n\f\r\"\\', 'btnfr"\\')
     │                            ~
     │
     └─ lib/encode.ex:284:28
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 284 │   slash_escapes = Enum.zip('\b\t\n\f\r\"\\', 'btnfr"\\')
     │                                              ~
     │
     └─ lib/encode.ex:284:46
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 166 │   defp pp_byte(byte, rest, output, depth, empty, opts) when byte in ' \n\r\t' do
     │                                                                     ~
     │
     └─ lib/formatter.ex:166:69
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 170 │   defp pp_byte(byte, rest, output, depth, empty, opts) when byte in '{[' do
     │                                                                     ~
     │
     └─ lib/formatter.ex:170:69
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 183 │   defp pp_byte(byte, rest, output, depth, true = _empty, opts) when byte in '}]' do
     │                                                                             ~
     │
     └─ lib/formatter.ex:183:77
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 189 │   defp pp_byte(byte, rest, output, depth, false = empty, opts) when byte in '}]' do
     │                                                                             ~
     │
     └─ lib/formatter.ex:189:77
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 195 │   defp pp_byte(byte, rest, output, depth, _empty, opts) when byte in ',' do
     │                                                                      ~
     │
     └─ lib/formatter.ex:195:70
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 201 │   defp pp_byte(byte, rest, output, depth, empty, opts) when byte in ':' do
     │                                                                     ~
     │
     └─ lib/formatter.ex:201:69
grzuy commented 3 months ago

I think these were fixed in https://github.com/michalmuskala/jason/pull/186 but not yet released.

michalmuskala commented 3 months ago

The fix is now released in 1.4.2. Sorry for the delay