Commit Graph

11 Commits

Author SHA1 Message Date
Jordan Rose
1c1aed747a Add some tests for @testable and subclassing.
Inspired by the previous commit. These are things we expect to keep
working.
2016-09-06 17:13:04 -07:00
Jordan Rose
c6a79209f7 Allow @testable witnesses to satisfy protocol requirements.
That is, if a would-be witness to a protocol requirement is only
accessible because its module has been imported with '@testable',
consider that "good enough" to satisfy the rule that a witness
must be available everywhere the protocol and conforming type are
both available (because those other contexts /could/ have done their
own testable import).

rdar://problem/28173654
2016-09-06 17:10:28 -07:00
John McCall
afdda3d107 Implement SE-0117.
One minor revision: this lifts the proposed restriction against
overriding a non-open method with an open one.  On reflection,
that was inconsistent with the existing rule permitting non-public
methods to be overridden with public ones.  The restriction on
subclassing a non-open class with an open class remains, and is
in fact consistent with the existing access rule.
2016-08-02 07:46:38 -07:00
Jordan Rose
5c1e9d7d36 [Accessibility] Store setter accessibility explicitly.
Previously, we were just storing setter accessibility via the accessibility
level on the setter function. However, some Stored properties never actually
have a setter synthesized, which led to the compiler dropping the setter
accessibility at serialization time. Rather than try to hack up something
clever, just store the setter accessibility explicitly in every
AbstractStorageDecl. (We still only serialize it for VarDecls, because
settable SubscriptDecls always have setter functions.)

<rdar://problem/17816530>

Swift SVN r20598
2014-07-26 22:43:54 +00:00
Jordan Rose
0c28c9c220 Add a test verifying that conformance checking respects access control.
<rdar://problem/17632316>

Swift SVN r20503
2014-07-24 17:58:23 +00:00
Jordan Rose
14196453cc Add a special diagnostic when a type has no accessible initializers.
Rather than just saying "'Foo' is not constructible with '()'", say
"'Foo' cannot be constructed because it has no accessible initializers",
which would help framework authors realize what they did wrong.

<rdar://problem/17717714>

Swift SVN r20232
2014-07-20 19:52:24 +00:00
Jordan Rose
2d3ae53222 Add a test that "super.foo" doesn't get around access control.
No functionality change.

Swift SVN r19971
2014-07-15 04:57:02 +00:00
Jordan Rose
5b80dc3d44 Respect accessibility for scoped imports.
"import var Foo.bar" should error if "Foo.bar" is not public.

Swift SVN r19747
2014-07-09 22:10:20 +00:00
Jordan Rose
ac90133b8c Update tests for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19673
2014-07-08 02:17:49 +00:00
Jordan Rose
76b24307a4 [Accessibility] Add some basic tests for member lookup.
This has been working for a while; there just weren't explicit tests for it.

Swift SVN r19621
2014-07-07 18:39:36 +00:00
Jordan Rose
a7b563855e Add a mode in which access control is respected for module-scope lookups.
This applies to both qualified and unqualified lookups, and is controlled
by the -enable-access-control and -disable-access-control flags. I've
included both so that -disable-access-control can be put into specific tests
that will eventually need to bypass access control (e.g. stdlib unit tests).
The default is still -disable-access-control.

Swift SVN r19146
2014-06-24 21:32:21 +00:00