Commit Graph

7 Commits

Author SHA1 Message Date
Suyash Srijan
cc49c6105c [Diagnostics] Update diagnostic message for invalid overrides (#33097)
* [Diagnostics] Update 'does not override' diagnostic message to include protocol context as well

* [Sema] Check whether the override context is a class or a protocol for diagnostic purposes

* [Test] Update tests with new diagnostic message for overrides in protocol context

* [Sema] Adjust diagnostic for overrides in structs and enums to use the existing 'override_nonclass_decl' diagnostic
2020-07-27 15:15:28 +01:00
Vinicius Vendramini
39d3963131 Fix broken tests
- Many tests got broken because of two things:
  - AST dump now outputs to stdout, but many tests expected stderr. This was a straightforward fix.
  - Many tests call swift with specific parameters; specifically, many call `swift frontend` directly. This makes them go through the compiler in unexpected ways, and specifically it makes them not have primary files, which breaks the new AST dump implementation. This commit adds the old implementation as a fallback for those cases, except it dumps to `stdout` to maintain some consistence.

Finally, the `/test/Driver/filelists.swift` failed for unknown reasons. It seems its output now had some lines out of order, and fixing the order made the test pass. However, as the reasons why it failed are unknown, this fix might not have been a good idea. Corrections are welcome.
2018-11-14 13:38:01 -02:00
Doug Gregor
368add14d9 [Type checker] Protocol overrides require exact matches.
With protocol overrides, we don’t want to deal with covariant overrides:
those are rare, and can be handled as overloads.
2018-09-05 13:51:26 -07:00
Doug Gregor
4903cf9985 Add @_nonoverride attribute to disable override checking.
@_nonoverride is the opposite of override, disabling all override checking
for the given declaration. This can be used to suppress diagnostics related
to declarations that are almost overrides but shouldn’t be or to 
intentionally break the override chain; in each case, we’ll end up with
an overload rather than an override.
2018-09-04 16:42:06 -07:00
Doug Gregor
64cb042a76 [Type checker] Allow the ‘override’ keyword on protocol members. 2018-09-04 16:42:06 -07:00
Doug Gregor
438d2606e6 [Override checking] Check property types correctly for protocol overrides. 2018-09-04 16:42:06 -07:00
Doug Gregor
0972111c60 [Type checker] Start tracking overrides of protocol requirements.
When a protocol that inherits another protocol restates a requirement
from its inherited protocol, track that as an override in the AST.
2018-09-04 16:42:06 -07:00