@@ -334,6 +334,159 @@ defmodule Module.Types.DescrTest do
334334
335335 assert difference ( tuple ( ) , open_tuple ( [ term ( ) , term ( ) ] ) )
336336 |> equal? ( union ( tuple ( [ term ( ) ] ) , tuple ( [ ] ) ) )
337+
338+ # Large difference with no duplicates
339+ descr1 = % {
340+ dynamic: % {
341+ atom: { :union , % { reset: [ ] , ignored: [ ] } } ,
342+ tuple: [
343+ { :closed , [ % { atom: { :union , % { font_style: [ ] } } } , % { atom: { :union , % { italic: [ ] } } } ] ,
344+ [ ] }
345+ ]
346+ }
347+ }
348+
349+ descr2 = % {
350+ dynamic: % {
351+ atom: { :union , % { reset: [ ] , ignored: [ ] } } ,
352+ tuple: [
353+ { :closed , [ % { atom: { :union , % { font_weight: [ ] } } } , % { atom: { :union , % { bold: [ ] } } } ] ,
354+ [ ] } ,
355+ { :closed , [ % { atom: { :union , % { font_style: [ ] } } } , % { atom: { :union , % { italic: [ ] } } } ] ,
356+ [ ] } ,
357+ { :closed , [ % { atom: { :union , % { font_weight: [ ] } } } , % { atom: { :union , % { clear: [ ] } } } ] ,
358+ [ ] } ,
359+ { :closed ,
360+ [
361+ % { atom: { :union , % { text_decoration: [ ] } } } ,
362+ % { atom: { :union , % { clear_decoration: [ ] } } }
363+ ] , [ ] } ,
364+ { :closed ,
365+ [
366+ % { atom: { :union , % { text_decoration: [ ] } } } ,
367+ % { atom: { :union , % { remove_decoration: [ ] } } }
368+ ] , [ ] } ,
369+ { :closed ,
370+ [
371+ % { atom: { :union , % { text_decoration: [ ] } } } ,
372+ % { atom: { :union , % { undo_decoration: [ ] } } }
373+ ] , [ ] } ,
374+ { :closed ,
375+ [
376+ % { atom: { :union , % { text_decoration: [ ] } } } ,
377+ % { atom: { :union , % { default_decoration: [ ] } } }
378+ ] , [ ] } ,
379+ { :closed ,
380+ [
381+ % { atom: { :union , % { foreground_color: [ ] } } } ,
382+ % { atom: { :union , % { clear_foreground: [ ] } } }
383+ ] , [ ] } ,
384+ { :closed ,
385+ [
386+ % { atom: { :union , % { foreground_color: [ ] } } } ,
387+ % { atom: { :union , % { remove_foreground: [ ] } } }
388+ ] , [ ] } ,
389+ { :closed ,
390+ [
391+ % { atom: { :union , % { foreground_color: [ ] } } } ,
392+ % { atom: { :union , % { undo_foreground: [ ] } } }
393+ ] , [ ] } ,
394+ { :closed ,
395+ [
396+ % { atom: { :union , % { foreground_color: [ ] } } } ,
397+ % { atom: { :union , % { default_foreground: [ ] } } }
398+ ] , [ ] } ,
399+ { :closed ,
400+ [
401+ % { atom: { :union , % { background_color: [ ] } } } ,
402+ % { atom: { :union , % { clear_background: [ ] } } }
403+ ] , [ ] } ,
404+ { :closed ,
405+ [
406+ % { atom: { :union , % { background_color: [ ] } } } ,
407+ % { atom: { :union , % { remove_background: [ ] } } }
408+ ] , [ ] } ,
409+ { :closed ,
410+ [
411+ % { atom: { :union , % { background_color: [ ] } } } ,
412+ % { atom: { :union , % { undo_background: [ ] } } }
413+ ] , [ ] } ,
414+ { :closed ,
415+ [
416+ % { atom: { :union , % { background_color: [ ] } } } ,
417+ % { atom: { :union , % { default_background: [ ] } } }
418+ ] , [ ] } ,
419+ { :closed ,
420+ [
421+ % { atom: { :union , % { text_decoration: [ ] } } } ,
422+ % { atom: { :union , % { overline: [ ] } } }
423+ ] , [ ] } ,
424+ { :closed ,
425+ [
426+ % { atom: { :union , % { text_decoration: [ ] } } } ,
427+ % { atom: { :union , % { clear_text: [ ] } } }
428+ ] , [ ] } ,
429+ { :closed ,
430+ [
431+ % { atom: { :union , % { text_decoration: [ ] } } } ,
432+ % { atom: { :union , % { remove_text: [ ] } } }
433+ ] , [ ] } ,
434+ { :closed ,
435+ [
436+ % { atom: { :union , % { text_decoration: [ ] } } } ,
437+ % { atom: { :union , % { undo_text: [ ] } } }
438+ ] , [ ] } ,
439+ { :closed ,
440+ [
441+ % { atom: { :union , % { text_decoration: [ ] } } } ,
442+ % { atom: { :union , % { default_text: [ ] } } }
443+ ] , [ ] } ,
444+ { :closed ,
445+ [
446+ % { atom: { :union , % { foreground_color: [ ] } } } ,
447+ % { atom: { :union , % { clear_fg: [ ] } } }
448+ ] , [ ] } ,
449+ { :closed ,
450+ [
451+ % { atom: { :union , % { foreground_color: [ ] } } } ,
452+ % { atom: { :union , % { remove_fg: [ ] } } }
453+ ] , [ ] } ,
454+ { :closed ,
455+ [
456+ % { atom: { :union , % { foreground_color: [ ] } } } ,
457+ % { atom: { :union , % { undo_fg: [ ] } } }
458+ ] , [ ] } ,
459+ { :closed ,
460+ [
461+ % { atom: { :union , % { foreground_color: [ ] } } } ,
462+ % { atom: { :union , % { default_fg: [ ] } } }
463+ ] , [ ] } ,
464+ { :closed ,
465+ [
466+ % { atom: { :union , % { background_color: [ ] } } } ,
467+ % { atom: { :union , % { clear_bg: [ ] } } }
468+ ] , [ ] } ,
469+ { :closed ,
470+ [
471+ % { atom: { :union , % { background_color: [ ] } } } ,
472+ % { atom: { :union , % { remove_bg: [ ] } } }
473+ ] , [ ] } ,
474+ { :closed ,
475+ [
476+ % { atom: { :union , % { background_color: [ ] } } } ,
477+ % { atom: { :union , % { undo_bg: [ ] } } }
478+ ] , [ ] } ,
479+ { :closed ,
480+ [
481+ % { atom: { :union , % { background_color: [ ] } } } ,
482+ % { atom: { :union , % { default_bg: [ ] } } }
483+ ] , [ ] }
484+ ]
485+ }
486+ }
487+
488+ assert subtype? ( descr1 , descr2 )
489+ refute subtype? ( descr2 , descr1 )
337490 end
338491
339492 test "map" do
@@ -1243,7 +1396,7 @@ defmodule Module.Types.DescrTest do
12431396 "{integer(), atom()} or {atom(), ...}"
12441397
12451398 assert difference ( tuple ( [ integer ( ) , atom ( ) ] ) , open_tuple ( [ atom ( ) ] ) ) |> to_quoted_string ( ) ==
1246- "{integer(), atom()} and not {atom(), ...} "
1399+ "{integer(), atom()}"
12471400
12481401 assert tuple ( [ closed_map ( a: integer ( ) ) , open_map ( ) ] ) |> to_quoted_string ( ) ==
12491402 "{%{a: integer()}, %{...}}"
0 commit comments