Hacker News new | ask | show | jobs
by mgoblu3 2874 days ago
There are some rules around this, as noted in https://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future:

  IF the inferred type of a variable is the protocol:
    AND the method is defined in the original protocol
      THEN the runtime type’s implementation is called, irrespective of whether there is a default implementation in the extension.
    AND the method is not defined in the original protocol,
      THEN the default implementation is called.
  ELSE IF the inferred type of the variable is the type
    THEN the type’s implementation is called.