Skip to content

Commit 2b57a97

Browse files
committed
Revert "Do not allow protocols to define structs nor exceptions, closes #14158"
Projects rely on this feature, therefore we have to revert to avoid breaking changes. This reverts commit 01c8202. Closes #14803.
1 parent 26612e5 commit 2b57a97

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/elixir/lib/protocol.ex

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -770,15 +770,7 @@ defmodule Protocol do
770770

771771
# We don't allow function definition inside protocols
772772
import Kernel,
773-
except: [
774-
def: 1,
775-
def: 2,
776-
defdelegate: 2,
777-
defguard: 1,
778-
defguardp: 1,
779-
defstruct: 1,
780-
defexception: 1
781-
]
773+
except: [def: 1, def: 2, defdelegate: 2, defguard: 1, defguardp: 1]
782774

783775
# Import the new `def` that is used by protocols
784776
import Protocol, only: [def: 1]

0 commit comments

Comments
 (0)