@@ -68,7 +68,7 @@ defmodule Gradient.AstSpecifierTest do
6868 { :clause , 2 , [ ] , [ ] ,
6969 [
7070 { :cons , 2 , { :integer , 2 , 97 } ,
71- { :cons , 2 , { :integer , 2 , 98 } , { :cons , 2 , { :integer , 2 , 99 } , { nil , 0 } } } }
71+ { :cons , 2 , { :integer , 2 , 98 } , { :cons , 2 , { :integer , 2 , 99 } , { nil , 2 } } } }
7272 ] }
7373 ] } = inline
7474
@@ -77,7 +77,7 @@ defmodule Gradient.AstSpecifierTest do
7777 { :clause , 4 , [ ] , [ ] ,
7878 [
7979 { :cons , 5 , { :integer , 5 , 97 } ,
80- { :cons , 5 , { :integer , 5 , 98 } , { :cons , 5 , { :integer , 5 , 99 } , { nil , 0 } } } }
80+ { :cons , 5 , { :integer , 5 , 98 } , { :cons , 5 , { :integer , 5 , 99 } , { nil , 5 } } } }
8181 ] }
8282 ] } = block
8383 end
@@ -123,7 +123,7 @@ defmodule Gradient.AstSpecifierTest do
123123 { :cons , 20 , { :tuple , 20 , [ { :atom , 20 , :pretty } , { :atom , 20 , true } ] } ,
124124 { :cons , 20 ,
125125 { :tuple , 20 , [ { :atom , 20 , :limit } , { :atom , 20 , :infinity } ] } ,
126- { nil , 0 } } }
126+ { nil , 20 } } }
127127 ] } , :default , [ :binary ] } ,
128128 { :bin_element , 20 , { :string , 20 , ' using default \n ' } , :default , :default }
129129 ] } } ,
@@ -188,7 +188,7 @@ defmodule Gradient.AstSpecifierTest do
188188 ] }
189189 ] } , :default , [ :binary ] }
190190 ] }
191- ] } , { nil , 0 } } }
191+ ] } , { nil , 15 } } }
192192 ] } , :default , [ :binary ] } ,
193193 { :bin_element , 15 , { :integer , 15 , 12 } , :default , [ :integer ] }
194194 ] }
@@ -200,7 +200,7 @@ defmodule Gradient.AstSpecifierTest do
200200 { :clause , 10 , [ ] , [ ] ,
201201 [
202202 { :cons , 11 , { :tuple , 11 , [ { :atom , 11 , :a } , { :integer , 11 , 12 } ] } ,
203- { :cons , 11 , { :tuple , 11 , [ { :atom , 11 , :b } , { :atom , 11 , :ok } ] } , { nil , 0 } } }
203+ { :cons , 11 , { :tuple , 11 , [ { :atom , 11 , :b } , { :atom , 11 , :ok } ] } , { nil , 11 } } }
204204 ] }
205205 ] } = tuple_in_list
206206
@@ -319,10 +319,11 @@ defmodule Gradient.AstSpecifierTest do
319319 [
320320 { :case , 13 , { :op , 13 , :< , { :integer , 13 , 1 } , { :integer , 13 , 5 } } ,
321321 [
322- { :clause , [ generated: true , location: 13 ] , [ { :atom , 0 , false } ] , [ ] ,
322+ { :clause , [ generated: true , location: 13 ] ,
323+ [ { :atom , [ generated: true , location: 13 ] , false } ] , [ ] ,
323324 [ { :atom , 16 , :error } ] } ,
324- { :clause , [ generated: true , location: 13 ] , [ { :atom , 0 , true } ] , [ ] ,
325- [ { :atom , 14 , :ok } ] }
325+ { :clause , [ generated: true , location: 13 ] ,
326+ [ { :atom , [ generated: true , location: 13 ] , true } ] , [ ] , [ { :atom , 14 , :ok } ] }
326327 ] }
327328 ] }
328329 ] } = block
@@ -333,10 +334,11 @@ defmodule Gradient.AstSpecifierTest do
333334 [
334335 { :case , 10 , { :op , 10 , :< , { :integer , 10 , 1 } , { :integer , 10 , 5 } } ,
335336 [
336- { :clause , [ generated: true , location: 10 ] , [ { :atom , 0 , false } ] , [ ] ,
337+ { :clause , [ generated: true , location: 10 ] ,
338+ [ { :atom , [ generated: true , location: 10 ] , false } ] , [ ] ,
337339 [ { :atom , 10 , :error } ] } ,
338- { :clause , [ generated: true , location: 10 ] , [ { :atom , 0 , true } ] , [ ] ,
339- [ { :atom , 10 , :ok } ] }
340+ { :clause , [ generated: true , location: 10 ] ,
341+ [ { :atom , [ generated: true , location: 10 ] , true } ] , [ ] , [ { :atom , 10 , :ok } ] }
340342 ] }
341343 ] }
342344 ] } = inline
@@ -347,10 +349,11 @@ defmodule Gradient.AstSpecifierTest do
347349 [
348350 { :case , 4 , { :op , 4 , :< , { :integer , 4 , 1 } , { :integer , 4 , 5 } } ,
349351 [
350- { :clause , [ generated: true , location: 4 ] , [ { :atom , 0 , false } ] , [ ] ,
352+ { :clause , [ generated: true , location: 4 ] ,
353+ [ { :atom , [ generated: true , location: 4 ] , false } ] , [ ] ,
351354 [ { :atom , 7 , :error } ] } ,
352- { :clause , [ generated: true , location: 4 ] , [ { :atom , 0 , true } ] , [ ] ,
353- [ { :atom , 5 , :ok } ] }
355+ { :clause , [ generated: true , location: 4 ] ,
356+ [ { :atom , [ generated: true , location: 4 ] , true } ] , [ ] , [ { :atom , 5 , :ok } ] }
354357 ] }
355358 ] }
356359 ] } = if_
@@ -372,14 +375,14 @@ defmodule Gradient.AstSpecifierTest do
372375 [
373376 { :case , 3 , { :atom , 3 , false } ,
374377 [
375- { :clause , [ generated: true , location: 3 ] , [ { :atom , 0 , false } ] , [ ] ,
376- [ { :atom , 4 , :ok } ] } ,
377- { :clause , [ generated: true , location: 3 ] , [ { :atom , 0 , true } ] , [ ] ,
378- [ { :atom , 6 , :error } ] }
378+ { :clause , [ generated: true , location: 3 ] ,
379+ [ { :atom , [ generated: true , location: 3 ] , false } ] , [ ] , [ { :atom , 4 , :ok } ] } ,
380+ { :clause , [ generated: true , location: 3 ] ,
381+ [ { :atom , [ generated: true , location: 3 ] , true } ] , [ ] , [ { :atom , 6 , :error } ] }
379382 ] }
380383 ] }
381384 ]
382- } == block
385+ } = block
383386 end
384387
385388 test "cond conditional" do
@@ -393,19 +396,19 @@ defmodule Gradient.AstSpecifierTest do
393396 [
394397 { :case , 4 , { :op , 5 , :== , { :var , 5 , :_a@1 } , { :atom , 5 , :ok } } ,
395398 [
396- { :clause , 5 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 5 , :ok } ] } ,
397- { :clause , 6 , [ { :atom , 0 , false } ] , [ ] ,
399+ { :clause , 5 , [ { :atom , 5 , true } ] , [ ] , [ { :atom , 5 , :ok } ] } ,
400+ { :clause , 6 , [ { :atom , 6 , false } ] , [ ] ,
398401 [
399402 { :case , 6 , { :op , 6 , :> , { :var , 6 , :_a@1 } , { :integer , 6 , 5 } } ,
400403 [
401- { :clause , 6 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 6 , :ok } ] } ,
402- { :clause , 7 , [ { :atom , 0 , false } ] , [ ] ,
404+ { :clause , 6 , [ { :atom , 6 , true } ] , [ ] , [ { :atom , 6 , :ok } ] } ,
405+ { :clause , 7 , [ { :atom , 7 , false } ] , [ ] ,
403406 [
404407 { :case , 7 , { :atom , 7 , true } ,
405408 [
406- { :clause , 7 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 7 , :error } ] } ,
407- { :clause , [ generated: true , location: 7 ] , [ { :atom , 0 , false } ] ,
408- [ ] ,
409+ { :clause , 7 , [ { :atom , 7 , true } ] , [ ] , [ { :atom , 7 , :error } ] } ,
410+ { :clause , [ generated: true , location: 7 ] ,
411+ [ { :atom , [ generated: true , location: 7 ] , false } ] , [ ] ,
409412 [
410413 { :call , 7 ,
411414 { :remote , 7 , { :atom , 7 , :erlang } , { :atom , 7 , :error } } ,
@@ -426,19 +429,19 @@ defmodule Gradient.AstSpecifierTest do
426429 { :match , 11 , { :var , 11 , :_a@1 } , { :integer , 11 , 5 } } ,
427430 { :case , 13 , { :op , 14 , :== , { :var , 14 , :_a@1 } , { :atom , 14 , :ok } } ,
428431 [
429- { :clause , 14 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 14 , :ok } ] } ,
430- { :clause , 15 , [ { :atom , 0 , false } ] , [ ] ,
432+ { :clause , 14 , [ { :atom , 14 , true } ] , [ ] , [ { :atom , 14 , :ok } ] } ,
433+ { :clause , 15 , [ { :atom , 15 , false } ] , [ ] ,
431434 [
432435 { :case , 15 , { :op , 15 , :> , { :var , 15 , :_a@1 } , { :integer , 15 , 5 } } ,
433436 [
434- { :clause , 15 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 15 , :ok } ] } ,
435- { :clause , 16 , [ { :atom , 0 , false } ] , [ ] ,
437+ { :clause , 15 , [ { :atom , 15 , true } ] , [ ] , [ { :atom , 15 , :ok } ] } ,
438+ { :clause , 16 , [ { :atom , 16 , false } ] , [ ] ,
436439 [
437440 { :case , 16 , { :atom , 16 , true } ,
438441 [
439- { :clause , 16 , [ { :atom , 0 , true } ] , [ ] , [ { :atom , 16 , :error } ] } ,
440- { :clause , [ generated: true , location: 16 ] , [ { :atom , 0 , false } ] ,
441- [ ] ,
442+ { :clause , 16 , [ { :atom , 16 , true } ] , [ ] , [ { :atom , 16 , :error } ] } ,
443+ { :clause , [ generated: true , location: 16 ] ,
444+ [ { :atom , [ generated: true , location: 16 ] , false } ] , [ ] ,
442445 [
443446 { :call , 16 ,
444447 { :remote , 16 , { :atom , 16 , :erlang } , { :atom , 16 , :error } } ,
@@ -476,7 +479,7 @@ defmodule Gradient.AstSpecifierTest do
476479 [ { :bin_element , 11 , { :string , 11 , 'error' } , :default , :default } ] }
477480 ] } ,
478481 { :cons , 12 , { :integer , 12 , 49 } ,
479- { :cons , 12 , { :integer , 12 , 50 } , { nil , 0 } } }
482+ { :cons , 12 , { :integer , 12 , 50 } , { nil , 12 } } }
480483 ] }
481484 ] }
482485 ] }
@@ -544,7 +547,7 @@ defmodule Gradient.AstSpecifierTest do
544547 [
545548 { :bin , 7 , [ { :bin_element , 7 , { :string , 7 , 'ala' } , :default , :default } ] } ,
546549 { :cons , 8 , { :integer , 8 , 97 } ,
547- { :cons , 8 , { :integer , 8 , 108 } , { :cons , 8 , { :integer , 8 , 97 } , { nil , 0 } } } } ,
550+ { :cons , 8 , { :integer , 8 , 108 } , { :cons , 8 , { :integer , 8 , 97 } , { nil , 8 } } } } ,
548551 { :integer , 9 , 12 }
549552 ] }
550553 ] }
@@ -570,7 +573,7 @@ defmodule Gradient.AstSpecifierTest do
570573 :integer ,
571574 4 ,
572575 2
573- } , { :cons , 4 , { :integer , 4 , 3 } , { nil , 0 } } } } ,
576+ } , { :cons , 4 , { :integer , 4 , 3 } , { nil , 4 } } } } ,
574577 { :fun , 4 ,
575578 { :clauses ,
576579 [
@@ -764,13 +767,13 @@ defmodule Gradient.AstSpecifierTest do
764767 { :clause , 5 , [ ] , [ ] ,
765768 [
766769 { :cons , 6 ,
767- { :cons , 6 , { :integer , 6 , 49 } , { :cons , 6 , { :integer , 6 , 49 } , { nil , 0 } } } ,
770+ { :cons , 6 , { :integer , 6 , 49 } , { :cons , 6 , { :integer , 6 , 49 } , { nil , 6 } } } ,
768771 { :cons , 6 ,
769772 { :bin , 6 , [ { :bin_element , 6 , { :string , 6 , '12' } , :default , :default } ] } ,
770773 { :cons , 6 , { :integer , 6 , 1 } ,
771774 { :cons , 6 , { :integer , 6 , 2 } ,
772775 { :cons , 6 , { :integer , 6 , 3 } ,
773- { :cons , 6 , { :call , 6 , { :atom , 6 , :wrap } , [ { :integer , 6 , 4 } ] } , { nil , 0 } } } } } } }
776+ { :cons , 6 , { :call , 6 , { :atom , 6 , :wrap } , [ { :integer , 6 , 4 } ] } , { nil , 6 } } } } } } }
774777 ] }
775778 ] } = list
776779
@@ -780,7 +783,7 @@ defmodule Gradient.AstSpecifierTest do
780783 [
781784 { :cons , 10 , { :var , 10 , :_a@1 } ,
782785 { :cons , 10 , { :integer , 10 , 1 } ,
783- { :cons , 10 , { :integer , 10 , 2 } , { :cons , 10 , { :integer , 10 , 3 } , { nil , 0 } } } } }
786+ { :cons , 10 , { :integer , 10 , 2 } , { :cons , 10 , { :integer , 10 , 3 } , { nil , 10 } } } } }
784787 ] }
785788 ] } = ht
786789
@@ -808,7 +811,8 @@ defmodule Gradient.AstSpecifierTest do
808811 [
809812 { :case , 4 , { :atom , 4 , true } ,
810813 [
811- { :clause , [ generated: true , location: 4 ] , [ { :atom , 0 , false } ] , [ ] ,
814+ { :clause , [ generated: true , location: 4 ] ,
815+ [ { :atom , [ generated: true , location: 4 ] , false } ] , [ ] ,
812816 [
813817 { :call , 7 , { :remote , 7 , { :atom , 7 , :erlang } , { :atom , 7 , :error } } ,
814818 [
@@ -822,7 +826,8 @@ defmodule Gradient.AstSpecifierTest do
822826 ] }
823827 ] }
824828 ] } ,
825- { :clause , [ generated: true , location: 4 ] , [ { :atom , 0 , true } ] , [ ] ,
829+ { :clause , [ generated: true , location: 4 ] ,
830+ [ { :atom , [ generated: true , location: 4 ] , true } ] , [ ] ,
826831 [
827832 { :call , 5 , { :remote , 5 , { :atom , 5 , :erlang } , { :atom , 5 , :throw } } ,
828833 [
@@ -922,7 +927,7 @@ defmodule Gradient.AstSpecifierTest do
922927 [
923928 { :bin , 41 ,
924929 [ { :bin_element , 41 , { :string , 41 , 'sample' } , :default , :default } ] } ,
925- { :cons , 41 , { :atom , 41 , :utf8 } , { :cons , 41 , { :atom , 41 , :write } , { nil , 0 } } }
930+ { :cons , 41 , { :atom , 41 , :utf8 } , { :cons , 41 , { :atom , 41 , :write } , { nil , 41 } } }
926931 ] } } ,
927932 { :try , 43 ,
928933 [
@@ -966,7 +971,7 @@ defmodule Gradient.AstSpecifierTest do
966971 { :call , 52 , { :remote , 52 , { :atom , 52 , Kernel.Utils } , { :atom , 52 , :raise } } ,
967972 [
968973 { :cons , 52 , { :integer , 52 , 49 } ,
969- { :cons , 52 , { :integer , 52 , 50 } , { nil , 0 } } }
974+ { :cons , 52 , { :integer , 52 , 50 } , { nil , 52 } } }
970975 ] }
971976 ] } ,
972977 { :integer , 53 , 1 }
@@ -1065,7 +1070,7 @@ defmodule Gradient.AstSpecifierTest do
10651070 [
10661071 { :map , 17 ,
10671072 [
1068- { :map_field_exact , 17 , { :atom , 17 , :x } ,
1073+ { :map_field_exact , 17 , { :atom , [ generated: true , location: 17 ] , :x } ,
10691074 { :var , [ generated: true , location: 17 ] , :_@1 } }
10701075 ] }
10711076 ] , [ ] , [ { :var , [ generated: true , location: 17 ] , :_@1 } ] } ,
@@ -1166,7 +1171,6 @@ defmodule Gradient.AstSpecifierTest do
11661171 [
11671172 { :clause , 7 , [ ] , [ ] ,
11681173 [ { :tuple , 8 , [ { :atom , 8 , :record_ex } , { :integer , 8 , 0 } , { :integer , 8 , 0 } ] } ] }
1169- # FIXME Should be a tuple with line 8, not 12. The line is taken from a token that is in another scope. Related to the cutting out tokens at the bottom
11701174 ] } = empty
11711175
11721176 assert { :function , 11 , :init , 0 ,
@@ -1175,14 +1179,16 @@ defmodule Gradient.AstSpecifierTest do
11751179 [ { :tuple , 12 , [ { :atom , 12 , :record_ex } , { :integer , 12 , 1 } , { :integer , 12 , 0 } ] } ] }
11761180 ] } = init
11771181
1182+ elixir_env_arg = if System . version ( ) >= "1.13" , do: :to_caller , else: :linify
1183+
11781184 assert { :function , 5 , :"MACRO-record_ex" , 1 ,
11791185 [
11801186 { :clause , 5 , [ { :var , 5 , :_@CALLER } ] , [ ] ,
11811187 [
11821188 { :match , 5 , { :var , 5 , :__CALLER__ } ,
1183- { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , :linify } } ,
1189+ { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , ^ elixir_env_arg } } ,
11841190 [ { :var , 5 , :_@CALLER } ] } } ,
1185- { :call , 5 , { :atom , 5 , :"MACRO-record_ex" } , [ { :var , 5 , :__CALLER__ } , { nil , 0 } ] }
1191+ { :call , 5 , { :atom , 5 , :"MACRO-record_ex" } , [ { :var , 5 , :__CALLER__ } , { nil , 5 } ] }
11861192 ] }
11871193 ] } = macro1
11881194
@@ -1191,13 +1197,13 @@ defmodule Gradient.AstSpecifierTest do
11911197 { :clause , 5 , [ { :var , 5 , :_@CALLER } , { :var , 5 , :_@1 } ] , [ ] ,
11921198 [
11931199 { :match , 5 , { :var , 5 , :__CALLER__ } ,
1194- { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , :linify } } ,
1200+ { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , ^ elixir_env_arg } } ,
11951201 [ { :var , 5 , :_@CALLER } ] } } ,
11961202 { :call , 5 , { :remote , 5 , { :atom , 5 , Record } , { :atom , 5 , :__access__ } } ,
11971203 [
11981204 { :atom , 5 , :record_ex } ,
11991205 { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :x } , { :integer , 5 , 0 } ] } ,
1200- { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :y } , { :integer , 5 , 0 } ] } , { nil , 0 } } } ,
1206+ { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :y } , { :integer , 5 , 0 } ] } , { nil , 5 } } } ,
12011207 { :var , 5 , :_@1 } ,
12021208 { :var , 5 , :__CALLER__ }
12031209 ] }
@@ -1209,13 +1215,13 @@ defmodule Gradient.AstSpecifierTest do
12091215 { :clause , 5 , [ { :var , 5 , :_@CALLER } , { :var , 5 , :_@1 } , { :var , 5 , :_@2 } ] , [ ] ,
12101216 [
12111217 { :match , 5 , { :var , 5 , :__CALLER__ } ,
1212- { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , :linify } } ,
1218+ { :call , 5 , { :remote , 5 , { :atom , 5 , :elixir_env } , { :atom , 5 , ^ elixir_env_arg } } ,
12131219 [ { :var , 5 , :_@CALLER } ] } } ,
12141220 { :call , 5 , { :remote , 5 , { :atom , 5 , Record } , { :atom , 5 , :__access__ } } ,
12151221 [
12161222 { :atom , 5 , :record_ex } ,
12171223 { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :x } , { :integer , 5 , 0 } ] } ,
1218- { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :y } , { :integer , 5 , 0 } ] } , { nil , 0 } } } ,
1224+ { :cons , 5 , { :tuple , 5 , [ { :atom , 5 , :y } , { :integer , 5 , 0 } ] } , { nil , 5 } } } ,
12191225 { :var , 5 , :_@1 } ,
12201226 { :var , 5 , :_@2 } ,
12211227 { :var , 5 , :__CALLER__ }
0 commit comments