File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ defmodule Kernel.Typespec do
575
575
unless Keyword . has_key? ( struct , field ) do
576
576
compile_error (
577
577
caller ,
578
- "undefined field #{ inspect ( field ) } on struct #{ Macro . to_string ( name ) } "
578
+ "undefined field #{ inspect ( field ) } on struct #{ inspect ( module ) } "
579
579
)
580
580
end
581
581
end
Original file line number Diff line number Diff line change @@ -521,12 +521,23 @@ defmodule TypespecTest do
521
521
end
522
522
523
523
test "@type with a struct with undefined field" do
524
- assert_raise CompileError , ~r" undefined field :no_field on struct TypespecSample" , fn ->
525
- test_module do
526
- defstruct [ :hello , :eric ]
527
- @ type my_type :: % TypespecSample { no_field: :world }
528
- end
529
- end
524
+ assert_raise CompileError ,
525
+ ~r" undefined field :no_field on struct TypespecTest.TypespecSample" ,
526
+ fn ->
527
+ test_module do
528
+ defstruct [ :hello , :eric ]
529
+ @ type my_type :: % TypespecSample { no_field: :world }
530
+ end
531
+ end
532
+
533
+ assert_raise CompileError ,
534
+ ~r" undefined field :no_field on struct TypespecTest.TypespecSample" ,
535
+ fn ->
536
+ test_module do
537
+ defstruct [ :hello , :eric ]
538
+ @ type my_type :: % __MODULE__ { no_field: :world }
539
+ end
540
+ end
530
541
end
531
542
532
543
test "@type when overriding Elixir built-in" do
You can’t perform that action at this time.
0 commit comments