You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/elixir/test/elixir/module/types/integration_test.exs
+50-39Lines changed: 50 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -449,10 +449,9 @@ defmodule Module.Types.IntegrationTest do
449
449
450
450
-:hello-
451
451
452
-
but the protocol was not yet implemented for any type and therefore will always fail. \
453
-
This error typically happens within libraries that define protocols and will disappear as \
454
-
soon as there is one implementation. If you expect the protocol to be implemented later on, \
455
-
you can define an implementation specific for development/test.
452
+
but the NoImplProtocol protocol was not yet implemented for any type and therefore will always fail.
453
+
454
+
This warning will disappear once you define a implementation. If the protocol is part of a library, you may define a dummy implementation for development/test.
456
455
457
456
typing violation found at:
458
457
│
@@ -479,53 +478,54 @@ defmodule Module.Types.IntegrationTest do
479
478
480
479
warnings=[
481
480
"""
482
-
warning: incompatible value given to string interpolation:
481
+
warning: incompatible types given to String.Chars.to_string/1:
483
482
484
-
data
483
+
to_string(data)
485
484
486
-
it has type:
485
+
given types:
487
486
488
487
-dynamic(%Range{})-
489
488
490
-
but expected a type that implements the String.Chars protocol. You either passed the wrong value or you forgot to implement the protocol.
489
+
but expected a type that implements the String.Chars protocol.
490
+
You either passed the wrong value or you must:
491
491
492
-
The String.Chars protocol is implemented for the following types:
493
-
494
-
dynamic(
495
-
%Date{} or %DateTime{} or %NaiveDateTime{} or %Time{} or %URI{} or %Version{} or
496
-
%Version.Requirement{}
497
-
) or atom() or binary() or empty_list() or float() or integer() or non_empty_list(term(), term())
492
+
1. convert the given value to a string explicitly
493
+
(use inspect/1 if you want to convert any data structure to a string)
494
+
2. implement the String.Chars protocol
498
495
499
496
where "data" was given the type:
500
497
501
498
# type: dynamic(%Range{})
502
-
# from: a.ex:3:24
499
+
# from: a.ex:2:24
503
500
_.._//_ = data
504
501
505
-
hint: string interpolation uses the String.Chars protocol to convert a data structure into a string. Either convert the data type into a string upfront or implement the protocol accordingly
502
+
hint: the String.Chars protocol is implemented for the following types:
503
+
504
+
dynamic(
505
+
%Date{} or %DateTime{} or %NaiveDateTime{} or %Time{} or %URI{} or %Version{} or
506
+
%Version.Requirement{}
507
+
) or atom() or binary() or empty_list() or float() or integer() or non_empty_list(term(), term())
506
508
""",
507
509
"""
508
-
warning: incompatible types given to String.Chars.to_string/1:
510
+
warning: incompatible value given to string interpolation:
509
511
510
-
to_string(data)
512
+
data
511
513
512
-
given types:
514
+
it has type:
513
515
514
516
-dynamic(%Range{})-
515
517
516
-
but expected a type that implements the String.Chars protocol. You either passed the wrong value or you forgot to implement the protocol.
518
+
but expected a type that implements the String.Chars protocol.
519
+
You either passed the wrong value or you must:
517
520
518
-
The String.Chars protocol is implemented for the following types:
519
-
520
-
dynamic(
521
-
%Date{} or %DateTime{} or %NaiveDateTime{} or %Time{} or %URI{} or %Version{} or
522
-
%Version.Requirement{}
523
-
) or atom() or binary() or empty_list() or float() or integer() or non_empty_list(term(), term())
521
+
1. convert the given value to a string explicitly
522
+
(use inspect/1 if you want to convert any data structure to a string)
523
+
2. implement the String.Chars protocol
524
524
525
525
where "data" was given the type:
526
526
527
527
# type: dynamic(%Range{})
528
-
# from: a.ex:2:24
528
+
# from: a.ex:3:24
529
529
_.._//_ = data
530
530
"""
531
531
]
@@ -555,29 +555,41 @@ defmodule Module.Types.IntegrationTest do
555
555
556
556
-dynamic(%Date{})-
557
557
558
-
but expected a type that implements the Enumerable protocol. You either passed the wrong value or you forgot to implement the protocol.
558
+
but expected a type that implements the Enumerable protocol.
559
+
You either passed the wrong value or you must:
559
560
560
-
The Enumerable protocol is implemented for the following types:
561
-
562
-
dynamic(
563
-
%Date.Range{} or %File.Stream{} or %GenEvent.Stream{} or %HashDict{} or %HashSet{} or
564
-
%IO.Stream{} or %MapSet{} or %Range{} or %Stream{}
565
-
) or empty_list() or fun() or non_empty_list(term(), term()) or non_struct_map()
561
+
1. convert the given value to an Enumerable explicitly
562
+
2. implement the Enumerable protocol
566
563
567
564
where "date" was given the type:
568
565
569
566
# type: dynamic(%Date{})
570
567
# from: a.ex:2:24
571
568
%Date{} = date
572
569
573
-
hint: for-comprehensions use the Enumerable protocol to traverse data structures. Either convert the data type into a list (or another Enumerable) or implement the protocol accordingly
570
+
hint: the Enumerable protocol is implemented for the following types:
571
+
572
+
dynamic(
573
+
%Date.Range{} or %File.Stream{} or %GenEvent.Stream{} or %HashDict{} or %HashSet{} or
574
+
%IO.Stream{} or %MapSet{} or %Range{} or %Stream{}
575
+
) or empty_list() or fun() or non_empty_list(term(), term()) or non_struct_map()
574
576
""",
575
577
"""
576
578
warning: incompatible value given to :into option in for-comprehension:
577
579
578
580
into: Date.utc_today()
579
581
580
582
it has type:
583
+
584
+
-dynamic(%Date{})-
585
+
586
+
but expected a type that implements the Collectable protocol.
587
+
You either passed the wrong value or you forgot to implement the protocol.
588
+
589
+
hint: the Collectable protocol is implemented for the following types:
590
+
591
+
dynamic(%File.Stream{} or %HashDict{} or %HashSet{} or %IO.Stream{} or %MapSet{}) or binary() or
592
+
empty_list() or non_empty_list(term(), term()) or non_struct_map()
581
593
""",
582
594
"""
583
595
warning: incompatible value given to :into option in for-comprehension:
@@ -588,14 +600,13 @@ defmodule Module.Types.IntegrationTest do
588
600
589
601
-integer()-
590
602
591
-
but expected a type that implements the Collectable protocol. You either passed the wrong value or you forgot to implement the protocol.
603
+
but expected a type that implements the Collectable protocol.
604
+
You either passed the wrong value or you forgot to implement the protocol.
592
605
593
-
The Collectable protocol is implemented for the following types:
606
+
hint: the Collectable protocol is implemented for the following types:
594
607
595
608
dynamic(%File.Stream{} or %HashDict{} or %HashSet{} or %IO.Stream{} or %MapSet{}) or binary() or
596
609
empty_list() or non_empty_list(term(), term()) or non_struct_map()
597
-
598
-
hint: the :into option in for-comprehensions use the Collectable protocol to build its result. Either pass a valid data type or implement the protocol accordingly
0 commit comments