Commit Graph

2530 Commits

Author SHA1 Message Date
Slava Pestov
acb37b2b55 AST: Set ClassDecl's HasDestructor bit in one place 2019-01-18 00:15:41 -05:00
Slava Pestov
a8d1910552 AST: Cache SuperclassDeclRequest
This fixes a significant build time regression since 4.2.

Fixes <rdar://problem/47305605>.
2019-01-15 23:24:36 -05:00
Pavel Yaskevich
b78ffa77e8 [AST] If access control is disabled adjust declaration access to maximum openness
This is a follow-up to https://github.com/apple/swift/pull/21783
which made `is{Setter}AccessibleFrom` respect `-disable-access-control`
flag. Now it's `getAdjustedFormalAccess` turn to do the same.
2019-01-14 21:26:11 -08:00
Pavel Yaskevich
69c622fc06 Merge pull request #21783 from xedin/rdar-30933988
[AST] `Decl::is*AccessibleFrom` methods should respect access control…
2019-01-14 14:06:44 -08:00
Rintaro Ishizaki
b446d6b051 Merge pull request #21377 from rintaro/ide-contextinfo
[SourceKit][IDE] New SourceKit request to retrieve context type information
2019-01-15 01:54:16 +09:00
Pavel Yaskevich
da8f384b22 [AST] Move get{Setter}FormalAccess' calls into checkAccess from is*AccessibleFrom` 2019-01-11 17:51:15 -08:00
Pavel Yaskevich
ddc2fa415e [AST] NFC: introduce ASTContext::isAccessControlDisabled 2019-01-11 17:30:10 -08:00
Pavel Yaskevich
5426e0df9e [AST] Decl::is*AccessibleFrom methods should respect access control flag
Otherwise integrated REPL and other tools like LLDB would produce
incorrect results or crash.

Resolves: rdar://problem/30933988
2019-01-11 17:30:10 -08:00
Rintaro Ishizaki
d17bb78a0b [AST] Add shouldHideFromEditor() method
This replaces shouldHideDeclFromCompletionResults() in IDE.
2019-01-10 17:52:36 +09:00
Parker Schuh
f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00
Slava Pestov
716ac81b3e AST: Cache protocol generic signature in GenericContext::getGenericSignature()
The generic signature of a protocol is simple enough that we can
build it directly when asked. However, be sure to cache it for
future use.
2019-01-08 22:58:12 -05:00
Nathan Hawes
c3723fd4d7 [sourcekitd][AST] Fix CursorInfo crash on method with unresolved default value
When printing its annotated decl, we would would assume the param's default
value is present if the default value kind was "Normal". The type checker
explicitly sets the default value to nullptr if it doesn't type check though, so
we were crashing for that case. Added the check.

Resolves rdar://problem/46694149
2018-12-21 18:13:53 -08:00
Slava Pestov
bfcf24ee4e AST: Rework @objcMembers inheritance to not depend on validation order
Sema would directly check for the presence of the @objcMembers attribute,
and inherit it from the immediate superclass in validateDecl().

We don't want validateDecl() to have side effects like this and this was
already a problem, because it would not inherit the attribute transitively
in some cases.

Instead, add a ClassDecl::hasObjCMembers() method that walks over all
ancestors and caches the result.

<rdar://problem/46420252>
2018-12-12 15:12:38 -05:00
Slava Pestov
bc4aa75b35 AST: Simplify GenericSignatureBuilder::computeRequirementSignature() 2018-12-11 23:55:41 -05:00
Slava Pestov
544e0a02d5 AST: Don't link together GenericParamLists of nested generic types
GenericParamList::OuterParameters would mirror the nesting structure
of generic DeclContexts. This resulted in redundant code and caused
unnecessary complications for extensions and protocols, whose
GenericParamLists are constructed after parse time.

Instead, lets only use OuterParameters to link together the multiple
parameter lists of a single extension, or parameter lists in SIL
functions.
2018-12-11 23:55:41 -05:00
Slava Pestov
c0bfaaf30f AST: Merge ProtocolDecl::createGenericParams() into createGenericParamsIfMissing() 2018-12-11 23:55:41 -05:00
Slava Pestov
7a038ff817 AST: Refactor ExtensionDecl::createGenericParamsIfMissing()
Let's use the same code path for protocol and non-protocol extensions;
we still have to do something special for protocol extensions though.
2018-12-11 23:22:18 -05:00
Slava Pestov
78e56079ed AST: Introduce ExtensionDecl::createGenericParamsIfMissing()
For now Sema still calls it manually, but soon we could make
getGenericParams() lazy, calling this automatically, since
there's really no reason to create the generic parameters
upfront when binding the extension.
2018-12-11 17:48:52 -05:00
Slava Pestov
1ca81c42b4 AST: Factor out GenericParamList::configureGenericParamDepth() 2018-12-11 17:48:52 -05:00
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
Slava Pestov
e160b85f8f Merge pull request #21117 from slavapestov/accessor-synthesis-cleanup
Accessor synthesis cleanup (NFC)
2018-12-07 19:53:26 -05:00
Harlan Haskins
c829506aca Merge pull request #21033 from harlanhaskins/trouble-at-the-roller-rink
[Sema] Diagnose internal(set) from @inlinable functions
2018-12-07 15:33:18 -08:00
Slava Pestov
6d1b866cc1 AST: Fix FuncDecl::getSourceRange() to do the right thing for accessors with synthesized bodies 2018-12-07 17:10:08 -05:00
Harlan Haskins
d30a3da32a [Sema] Non-requirement protocol members should inherit @usableFromInline
Previously, members of protocols that were not protocol requirements,
like accessors and typealiases, did not inherit @usableFromInline from
the parent protocol. Change this so they do.
2018-12-07 12:45:32 -08:00
John McCall
8112f68b96 Merge pull request #20629 from rjmccall/error-self-conformance
Allow Error to conform to itself
2018-12-05 19:58:08 -05:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Slava Pestov
473a2cb38c AST: Members of @_weakLinked types are implicitly @_weakLinked 2018-12-03 20:36:03 -05:00
Slava Pestov
4289f76064 AST: Introduce ClassDecl::hasResilientMetadata() 2018-11-29 23:20:02 -05:00
Slava Pestov
fcb52172fc AST: Change isResilient() to do the cheaper check first 2018-11-29 23:20:02 -05:00
Pavel Yaskevich
e18d390d18 Merge pull request #20663 from hamishknight/packing-up-the-flags
[AST] NFC: Pack @autoclosure parameter decl flag with the default value
2018-11-17 12:27:16 -08:00
Slava Pestov
e8e1f4f80d Merge pull request #20593 from slavapestov/keypath-resilience-fixes
Fix key paths for resilience and @inlinable
2018-11-17 13:13:53 -05:00
Hamish Knight
bec9a8c9cb [AST] NFC: Pack @autoclosure parameter decl flag with the default value 2018-11-17 13:31:40 +00:00
David Zarzycki
e4fb140355 Merge pull request #20501 from davezarzycki/fix_28870_crasher
[AST] NFC: Add reentrancy check to associated type anchor walk
2018-11-17 07:26:37 -05:00
John McCall
49ba9c59d1 Allow Error to conform to itself.
Most of the foundation for this was laid in earlier patches.
2018-11-17 02:51:45 -05:00
Slava Pestov
0e1b62dcad SILGen: Don't emit or reference property descriptors for overrides
We want removing a property override to be a resilient change, so
keypaths should not reference them, preferring to reference the
base declaration instead.
2018-11-16 23:18:30 -05:00
Slava Pestov
0a8ee10621 AST: Refactor AbstractStorageDecl::getAccessStrategy() for keypath resilience
Instead of passing in a DeclContext, which we don't have when emitting a keypath
accessor, pass in a ModuleDecl and ResilienceExpansion.

Keypaths now work well enough in inlinable contexts that we can check in an
end-to-end resilience test.
2018-11-16 23:18:30 -05:00
Slava Pestov
99c78894ef IRGen: Fix crash when emitting metadata for enum with @autoclosure case
Fixes <rdar://problem/45962425>, <https://bugs.swift.org/browse/SR-9169>.
2018-11-16 01:18:18 -05:00
Slava Pestov
558b517b08 AST: Fast path for requiresNewVTableEntry() when called on non-class members 2018-11-15 16:10:52 -05:00
Arnold Schwaighofer
40f0c43e31 Add isNativeDynamic() and use it 2018-11-14 12:04:41 -08:00
Arnold Schwaighofer
893318c114 Fix the AccessStrategy for dynamic (not @objc) storage
It needs to be opaque but not dispatched.
2018-11-13 15:20:27 -08:00
David Zarzycki
e8eabd7f47 [AST] NFC: Add reentrancy check to associated type anchor walk
This makes compiler crasher 28870 crash faster and reliably instead of
recursing off the end of the stack.

This reverts: 614cb48b63
2018-11-13 08:29:26 -05:00
Pavel Yaskevich
bce1ba5f37 [AST] Remove @autoclosure flag from function type ExtInfo 2018-11-10 11:59:29 -08:00
Pavel Yaskevich
d9504ef919 [TypeChecker] Add typeCheckParameterDefault method
`typeCheckParameterDefault` is used to type-check default value
expression associated with a given parameter. It makes it possible
to look-through `@autoclosure` function to use its result as
contextual type, and later build implicit autoclosure expression
if needed.
2018-11-10 11:59:28 -08:00
Pavel Yaskevich
4c1885b51b [AST] Register @autoclosure as parameter decl flag
It should become a declaration attribute instead,
but it can't be done at the moment because `@autoclosure`
is a type attribute.
2018-11-10 11:58:49 -08:00
Slava Pestov
c7338d06ca AST: Remove owning addressors 2018-11-09 20:49:44 -05:00
Slava Pestov
a1ae75b2ba Merge pull request #20455 from slavapestov/fix-misc-regressions
Fix a handful of regressions
2018-11-09 13:20:44 -05:00
John McCall
e741147d70 Merge pull request #20459 from rjmccall/key-path-lvalue-emission
Always use the l-value logic for emitting key path applications
2018-11-09 12:08:27 -05:00
John McCall
c0285a744c Always use the l-value logic for emitting key path applications.
Not NFC because it also fixes an evaluation order bug (and reorders
some less-important stuff): the key-path expression needs to be
evaluated immediately during formal evaluation and cannot be delayed
until start-of-access.
2018-11-09 02:42:17 -05:00
Arnold Schwaighofer
6cc3d377ff Refactor part2 2018-11-08 18:16:17 -08:00
Slava Pestov
9dd63a4918 AST: Use resilient access pattern for stored properties of resilient types visible via -enable-testing
Fixes <rdar://problem/45919829>.
2018-11-08 19:43:31 -05:00