@@ -393,6 +393,7 @@ defmodule TypespecTest do
393393 @ type size :: << _ :: 3 >>
394394 @ type unit :: << _ :: _ * 8 >>
395395 @ type size_and_unit :: << _ :: 3 , _ :: _ * 8 >>
396+ @ type size_prod_unit :: << _ :: 3 * 8 >>
396397 end
397398
398399 assert [
@@ -401,17 +402,15 @@ defmodule TypespecTest do
401402 type: { :size , { :type , _ , :binary , [ { :integer , _ , 3 } , { :integer , _ , 0 } ] } , [ ] } ,
402403 type:
403404 { :size_and_unit , { :type , _ , :binary , [ { :integer , _ , 3 } , { :integer , _ , 8 } ] } , [ ] } ,
405+ type:
406+ { :size_prod_unit ,
407+ { :type , _ , :binary ,
408+ [ { :op , _ , :* , { :integer , _ , 3 } , { :integer , _ , 8 } } , { :integer , _ , 0 } ] } , [ ] } ,
404409 type: { :unit , { :type , _ , :binary , [ { :integer , _ , 0 } , { :integer , _ , 8 } ] } , [ ] }
405410 ] = types ( bytecode )
406411 end
407412
408413 test "@type with invalid binary spec" do
409- assert_raise Kernel.TypespecError , ~r" invalid binary specification" , fn ->
410- test_module do
411- @ type my_type :: << _ :: 3 * 8 >>
412- end
413- end
414-
415414 assert_raise Kernel.TypespecError , ~r" invalid binary specification" , fn ->
416415 test_module do
417416 @ type my_type :: << _ :: atom ( ) >>
@@ -1217,6 +1216,7 @@ defmodule TypespecTest do
12171216 quote ( do: @ type ( binary_type1 ( ) :: << _ :: _ * 8 >> ) ) ,
12181217 quote ( do: @ type ( binary_type2 ( ) :: << _ :: 3 >> ) ) ,
12191218 quote ( do: @ type ( binary_type3 ( ) :: << _ :: 3 , _ :: _ * 8 >> ) ) ,
1219+ quote ( do: @ type ( binary_type4 ( ) :: << _ :: 3 * 8 >> ) ) ,
12201220 quote ( do: @ type ( tuple_type ( ) :: { integer ( ) } ) ) ,
12211221 quote ( do: @ type ( ftype ( ) :: ( -> any ( ) ) | ( -> integer ( ) ) | ( integer ( ) -> integer ( ) ) ) ) ,
12221222 quote ( do: @ type ( cl ( ) :: charlist ( ) ) ) ,
0 commit comments