Commit Graph

12606 Commits

Author SHA1 Message Date
Doug Gregor
17846e2be1 [GSB] Cope with recursive requirements by delaying them.
Rather than detecting recursion and bailing early, delay requirements
that would form recursive types. Note that we aren't actually
processing them later.
2017-04-17 23:13:21 -07:00
Doug Gregor
995de881c7 [GSB] Teach addInheritedRequirements() and its callers to use UnresolvedType.
Teach addInheritedRequirements() to take an UnresolvedType, so the
requirements it adds can be delayed if needed. More importantly, teach
the primary caller (addConformanceRequirement) not to use
getNestedType directly; instead, form an appropriate Type and let the
type-resolution machinery handle it.
2017-04-17 23:13:21 -07:00
swift-ci
6d2515053f Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 19:48:31 -07:00
swift-ci
d1be8b03fb Merge pull request #8824 from gottesmm/mark_uninitialized_fixup 2017-04-17 19:44:24 -07:00
Michael Gottesman
aa76c2a5e6 [silgen] (mark_uninitialized (project_box (alloc_box))) -> (project_box (mark_uninitialized (alloc_box)))
I put in a simple fixup pass (MarkUninitializedFixup) for staging purposes. I
don't expect it to be in tree long. I just did not feel comfortable fixing up in
1 commit all of the passes up to DI.

rdar://31521023
2017-04-17 17:45:54 -07:00
swift-ci
05599208ee Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 17:08:32 -07:00
Slava Pestov
cc611de2aa Merge pull request #8788 from slavapestov/subclass-existentials-irgen
Tiny bit more progress on IRGen support for subclass existentials
2017-04-17 17:05:06 -07:00
swift-ci
b56ee3d799 Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 16:48:32 -07:00
Arnold Schwaighofer
98e6367f22 Merge pull request #8815 from aschwaighofer/runtime_support_builtin_int512
Runtime: Add support for Builtin.Int512
2017-04-17 16:42:22 -07:00
swift-ci
0a7a14e29c Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 16:28:36 -07:00
David Farler
303a3e5824 Start the Migrator library
The Swift 4 Migrator is invoked through either the driver and frontend
with the -update-code flag.

The basic pipeline in the frontend is:

- Perform some list of syntactic fixes (there are currently none).
- Perform N rounds of sema fix-its on the primary input file, currently
  set to 7 based on prior migrator seasons.  Right now, this is just set
  to take any fix-it suggested by the compiler.
- Emit a replacement map file, a JSON file describing replacements to a
  file that Xcode knows how to understand.

Currently, the Migrator maintains a history of migration states along
the way for debugging purposes.

- Add -emit-remap frontend option
  This will indicate the EmitRemap frontend action.
- Don't fork to a separte swift-update binary.
  This is going to be a mode of the compiler, invoked by the same flags.
- Add -disable-migrator-fixits option
  Useful for debugging, this skips the phase in the Migrator that
  automatically applies fix-its suggested by the compiler.
- Add -emit-migrated-file-path option
  This is used for testing/debugging scenarios. This takes the final
  migration state's output text and writes it to the file specified
  by this option.
- Add -dump-migration-states-dir

  This dumps all of the migration states encountered during a migration
  run for a file to the given directory. For example, the compiler
  fix-it migration pass dumps the input file, the output file, and the
  remap file between the two.

  State output has the following naming convention:
  ${Index}-${MigrationPassName}-${What}.${extension}, such as:
  1-FixitMigrationState-Input.swift

rdar://problem/30926261
2017-04-17 16:25:02 -07:00
Slava Pestov
2cd6a03e5d AST: Remove getExistentialTypeProtocols() 2017-04-17 17:22:30 -06:00
Slava Pestov
19eb8d2821 SIL Parser: Update for subclass existentials
Tested by an upcoming patch that adds IRGen SIL tests.
2017-04-17 17:22:28 -06:00
Roman Levenstein
9463b60973 Merge pull request #8792 from swiftix/wip-canonical-conformances
Add a functionality to produce canonical conformances and substitutions to fix a bug with SILBoxType’s generic arguments
2017-04-17 16:13:20 -07:00
Adrian Prantl
88592ecce6 Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 14:24:23 -07:00
John McCall
82c2d11632 Allow dynamic access markers in non-raw SIL. 2017-04-17 17:16:13 -04:00
John McCall
2c40b39f26 Move runtime functions for casting into their own header. 2017-04-17 17:16:13 -04:00
Jordan Rose
4e04061861 Merge pull request #8767 from jrose-apple/mangle-typealiases-better
Improve the mangling of USRs in several ways.
2017-04-17 13:32:24 -07:00
swift-ci
2c5c7d573e Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 13:08:41 -07:00
Xi Ge
ba33fd6236 swift-api-digester: Add a data structure APIDiffItemStore. (#8794)
This structure serves multiple purposes:
	a. Allow migrator to speak in the same language with swift-api-digester in terms of API changes.
	b. Serialize/Deserialize detected API change items in JSON format.
	c. Manage memory after deserializing API change items.
	d. Facilitate look up by USRs of APIs under migration.
The structure is tested by round-trip serialization and deserialization.
2017-04-17 13:04:02 -07:00
Roman Levenstein
07d779058a Address review comments
- Avoid unnecessary memory allocation
- Fix spelling errors
- Some further minor fixes
2017-04-17 11:44:57 -07:00
Jordan Rose
2d84981fc2 Improve the mangling of typealiases.
- Allow them to use substitutions.
- Consistently use 'a' as a mangling operator.
- For generic typealiases, include the alias as context for any generic
  parameters.

Typealiases don't show up in symbol names, which always refer to
canonical types, but they are mangled for debug info and for USRs
(unique identifiers used by SourceKit), so it's good to get this
right.
2017-04-17 11:31:15 -07:00
Jordan Rose
5de0a39f62 [Mangler] Verify USR manglings as well. 2017-04-17 11:31:15 -07:00
Jordan Rose
3b07eda6aa [Mangler] Use '_' to represent nameless entities.
This can show up when trying to generate USRs for a document with
errors in it. This isn't a great answer because the names it generates
aren't unique (there may be more than one nameless entity with the
same type), but it at least generates valid mangled names.

When generating mangled names for purposes other than USRs, nameless
entities are now checked for by an assertion.
2017-04-17 11:31:11 -07:00
Huon Wilson
d26c9791e5 [AST] Classes know their appropriate metaclass. 2017-04-17 11:28:55 -07:00
Arnold Schwaighofer
1d2e46bbec Runtime: Add support for Builtin.Int512
rdar://31540879
2017-04-17 09:58:42 -07:00
swift-ci
3a9efb697d Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 09:56:00 -07:00
Doug Gregor
280bb3091f [GSB] Remove an unused entrypoint. 2017-04-16 23:05:55 -07:00
Doug Gregor
3b9cb5afa9 [GSB] Drop derived-from-concrete superclass/layout/etc. constraints.
Apply the same logic used for self-derived conformance constraints,
where we drop constraints derived from concrete conformances, to the
remaining kinds of constraints covered by isSelfDerivedSource().
2017-04-16 23:05:28 -07:00
Doug Gregor
0f5d561dbe [GSB] Factor out a path-walking operation visitPotentialArchetypesAlongPath().
Factor out a core operation of RequirementSource that walks the
potential archetypes from the root to the end of the path, enumerating
each partial RequirementSource along with the potential archetype to
which it applies. Use it for getting the final archetype to which the
RequirementSource refers, as well as simplifying the self-derived
check for conformance requirements.
2017-04-16 23:05:27 -07:00
Doug Gregor
8dfc25edc7 [GSB] Filter out conformance constraints derived from concrete conformance.
When an otherwise abstract conformance constraint is derived from a
concrete conformance, retain the abstract conformance by removing the
requirement source that involves the concrete conformance. This
eliminates our reliance on the concrete conformance, which is not
retained as part of the generic signature.

Fixes rdar://problem/31163470 and rdar://problem/31520386.
2017-04-16 23:05:23 -07:00
swift-ci
10cea13716 Merge remote-tracking branch 'origin/master' into master-next 2017-04-15 14:48:47 -07:00
Devin Coughlin
8d180f4bdc [SILDiagnostics] Add suppression for swap() to static access enforcement.
Add a SILLocation-based syntactic suppression for diagnostics of static
access conflicts on the arguments to the Standard Library's swap() free
function. We'll suppress for calls to this function until we have a safe
replacement.
2017-04-15 14:00:38 -07:00
swift-ci
0142fa1f13 Merge remote-tracking branch 'origin/master' into master-next 2017-04-15 10:08:32 -07:00
practicalswift
b8ca098949 Merge pull request #8742 from practicalswift/gardening-20170413
[gardening] Use consistent headers. Remove redundant includes. Remove unused methods. Fix typos, etc.
2017-04-15 18:59:30 +02:00
Roman Levenstein
049ba39da4 Address review comments 2017-04-14 22:17:55 -07:00
Roman Levenstein
6b466c5e1f Add a functionality to produce canonical conformances and substitutions
A canonical conformance is defined as a conformance which:
- does not contain any non-canonical types.
- Its type and interface type should be canonical.
- Any referenced conformances should be canonical.
- Any used substitutions should be canonical as well.

A substitution is canonical if:
- its replacement type is canonical
- all of its conformances are canonical
2017-04-14 19:53:51 -07:00
swift-ci
304364d06e Merge remote-tracking branch 'origin/master' into master-next 2017-04-14 17:48:34 -07:00
swift-ci
d99141c312 Merge pull request #8786 from DougGregor/gsb-requirement-inference 2017-04-14 17:45:10 -07:00
swift-ci
fe1b506392 Merge remote-tracking branch 'origin/master' into master-next 2017-04-14 17:28:31 -07:00
Doug Gregor
faa0401598 [GSB] Allow requirement inference for synthesized requirements. 2017-04-14 17:19:02 -07:00
Doug Gregor
8a4451dda9 [GSB] Infer requirements from concrete types in requirements.
When a requirement mentions a concrete type, that type might utter
other types (e.g., Set<T>) that infer requirements (here, T:
Hashable). Perform requirement inference for such types.

Part of rdar://problem/31520386.
2017-04-14 17:19:01 -07:00
Maxwell Swadling
5623095901 Merge pull request #8777 from mxswd/format-diags
Changed handleDiagnostic to take a format string and format args instead of the formatted string
2017-04-14 17:17:12 -07:00
Joe Groff
ee66ff35c5 SILGen: Lower computed property key path components. 2017-04-14 17:13:38 -07:00
swift-ci
ac1c34d64e Merge remote-tracking branch 'origin/master' into master-next 2017-04-14 17:08:41 -07:00
Jordan Rose
5c80f1edaf [IDE] Don't produce USRs for nameless parameters.
...and /do/ produce them for 'self' parameters in destructors when
they /are/ named. I suspect this was the cause of the original
problem.
2017-04-14 17:02:55 -07:00
swift-ci
c1b92dbf77 Merge pull request #8782 from devincoughlin/static-enforcement-warning 2017-04-14 16:58:12 -07:00
Devin Coughlin
4cb51f77fd [SILDiagnostics] Demote exclusivity violation error to warning.
Change the error emitted when diagnosing an exclusivity violation to an warning.
This will make it easier to evaluate on large projects while staging. The
intent it to turn it back into an error before the diagnosis is turned on
by default.
2017-04-14 16:26:50 -07:00
swift-ci
c2966bc00d Merge remote-tracking branch 'origin/master' into master-next 2017-04-14 13:48:32 -07:00
Huon Wilson
754d74ab8f Merge pull request #8753 from huonw/open-public-class-methods
Only `open`, not `public`, classes need public symbols
2017-04-14 13:35:00 -07:00