Skip to content

Commit 9f31350

Browse files
Merge pull request #4542 from swiftwasm/main
[pull] swiftwasm from main
2 parents cac3dbc + f387076 commit 9f31350

File tree

278 files changed

+1518
-11994
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+1518
-11994
lines changed

CHANGELOG.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
330330

331331
* [SE-0328][]:
332332

333-
Opaque types (expressed with 'some') can now be used in structural positions
333+
Opaque types (expressed with `some`) can now be used in structural positions
334334
within a result type, including having multiple opaque types in the same
335335
result. For example:
336336

@@ -942,7 +942,7 @@ Swift 5.5
942942
}
943943
```
944944

945-
* The 'lazy' keyword now works in local contexts, making the following valid:
945+
* The `lazy` keyword now works in local contexts, making the following valid:
946946

947947
```swift
948948
func test(useIt: Bool) {
@@ -2901,7 +2901,7 @@ Swift 3.0
29012901

29022902
* [SE-0101][]:
29032903

2904-
The functions `sizeof()`, `strideof()`, and `alignof()` have been removed.
2904+
The functions `sizeof()`, `strideof()`, and `alignof()` have been removed.
29052905
Memory layout properties for a type `T` are now spelled
29062906
`MemoryLayout<T>.size`, `MemoryLayout<T>.stride`, and
29072907
`MemoryLayout<T>.alignment`, respectively.
@@ -2943,7 +2943,7 @@ Swift 3.0
29432943

29442944
* [SE-0124][]:
29452945

2946-
Initializers on `Int` and `UInt` that accept an `ObjectIdentifier` must now use an explicit `bitPattern` label.
2946+
Initializers on `Int` and `UInt` that accept an `ObjectIdentifier` must now use an explicit `bitPattern` label.
29472947

29482948
```swift
29492949
let x: ObjectIdentifier = ...
@@ -3199,7 +3199,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
31993199
didFailToRegisterForRemoteNotificationsWithError error: NSError)
32003200
```
32013201

3202-
Now it accepts an `Error` argument:
3202+
Now it accepts an `Error` argument:
32033203

32043204
```swift
32053205
optional func application(_ application: UIApplication,
@@ -3422,7 +3422,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
34223422
foo/* comment */! // no longer works
34233423
```
34243424

3425-
Parse errors resulting from this change can be resolved by moving the comment outside the expression.
3425+
Parse errors resulting from this change can be resolved by moving the comment outside the expression.
34263426

34273427
* [SE-0031][]:
34283428

@@ -3483,7 +3483,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
34833483
Attributes change from using `=` in parameters lists
34843484
to using `:`, aligning with function call syntax.
34853485

3486-
```
3486+
```swift
34873487
// before
34883488
@available(*, unavailable, renamed="MyRenamedProtocol")
34893489

@@ -3524,13 +3524,13 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
35243524

35253525
Curried function syntax (with successive parenthesized groups of arguments) is removed, and now produces a compile-time error. Use chained functional return types instead.
35263526

3527-
```
3528-
// Before
3529-
public func project(function f: FunctionType)(p0: CGPoint, p1: CGPoint)(x: CGFloat) -> CGPoint
3527+
```swift
3528+
// Before
3529+
public func project(function f: FunctionType)(p0: CGPoint, p1: CGPoint)(x: CGFloat) -> CGPoint
35303530

3531-
// After
3532-
public func project(function f: FunctionType) -> (p0: CGPoint, p1: CGPoint) -> (x: CGFloat) -> CGPoint
3533-
```
3531+
// After
3532+
public func project(function f: FunctionType) -> (p0: CGPoint, p1: CGPoint) -> (x: CGFloat) -> CGPoint
3533+
```
35343534

35353535
* Generic signatures can now contain superclass requirements with generic parameter types, for example:
35363536

@@ -4877,11 +4877,15 @@ Swift 1.2
48774877
* The `@autoclosure` attribute is now an attribute on a parameter, not an
48784878
attribute on the parameter's type.
48794879

4880-
Where before you might have used:
4880+
Where before you might have used
48814881

48824882
```swift
48834883
func assert(predicate : @autoclosure () -> Bool) {...}
4884-
you now write this as:
4884+
```
4885+
4886+
you now write this as
4887+
4888+
```swift
48854889
func assert(@autoclosure predicate : () -> Bool) {...}
48864890
```
48874891

@@ -4923,7 +4927,11 @@ Swift 1.2
49234927
// redeclares Objective-C method
49244928
//'setProperty:'
49254929
}
4930+
```
4931+
49264932
Similar checking applies to accidental overrides in the Objective-C runtime:
4933+
4934+
```swift
49274935
class B : NSObject {
49284936
func method(arg: String) { } // note: overridden declaration
49294937
// here has type '(String) -> ()'
@@ -4934,7 +4942,11 @@ Swift 1.2
49344942
// selector 'method:' has incompatible
49354943
// type '([String]) -> ()'
49364944
}
4945+
```
4946+
49374947
as well as protocol conformances:
4948+
4949+
```swift
49384950
class MyDelegate : NSObject, NSURLSessionDelegate {
49394951
func URLSession(session: NSURLSession, didBecomeInvalidWithError:
49404952
Bool){ } // error: Objective-C method 'URLSession:didBecomeInvalidWithError:'
@@ -5022,13 +5034,17 @@ Swift 1.2
50225034
that used `unsafeBitCast` as a workaround for this issue can be written to
50235035
use the raw value initializer.
50245036

5025-
For example:
5037+
For example,
50265038

50275039
```swift
50285040
let animationCurve =
50295041
unsafeBitCast(userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue,
50305042
UIViewAnimationCurve.self)
5031-
can now be written instead as:
5043+
```
5044+
5045+
can now be written instead as
5046+
5047+
```swift
50325048
let animationCurve = UIViewAnimationCurve(rawValue:
50335049
userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue)!
50345050
```

SwiftCompilerSources/Sources/SIL/BasicBlock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasName {
2525
public var function: Function { SILBasicBlock_getFunction(bridged).function }
2626

2727
public var description: String {
28-
let s = SILBasicBlock_debugDescription(bridged)
28+
var s = SILBasicBlock_debugDescription(bridged)
2929
return String(cString: s.c_str())
3030
}
3131

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final public class Function : CustomStringConvertible, HasName {
2121
}
2222

2323
final public var description: String {
24-
let s = SILFunction_debugDescription(bridged)
24+
var s = SILFunction_debugDescription(bridged)
2525
return String(cString: s.c_str())
2626
}
2727

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final public class GlobalVariable : CustomStringConvertible, HasName {
1919
}
2020

2121
public var description: String {
22-
let s = SILGlobalVariable_debugDescription(bridged)
22+
var s = SILGlobalVariable_debugDescription(bridged)
2323
return String(cString: s.c_str())
2424
}
2525

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
3838
final public var function: Function { block.function }
3939

4040
final public var description: String {
41-
let s = SILNode_debugDescription(bridgedNode)
41+
var s = SILNode_debugDescription(bridgedNode)
4242
return String(cString: s.c_str())
4343
}
4444

@@ -136,7 +136,7 @@ public class SingleValueInstruction : Instruction, Value {
136136

137137
public final class MultipleValueInstructionResult : Value {
138138
final public var description: String {
139-
let s = SILNode_debugDescription(bridgedNode)
139+
var s = SILNode_debugDescription(bridgedNode)
140140
return String(cString: s.c_str())
141141
}
142142

SwiftCompilerSources/Sources/SIL/Value.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public protocol Value : AnyObject, CustomStringConvertible {
2121

2222
extension Value {
2323
public var description: String {
24-
let s = SILNode_debugDescription(bridgedNode)
24+
var s = SILNode_debugDescription(bridgedNode)
2525
return String(cString: s.c_str())
2626
}
2727

include/swift/AST/Attr.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ SIMPLE_DECL_ATTR(objcMembers, ObjCMembers,
268268
34)
269269
CONTEXTUAL_SIMPLE_DECL_ATTR(_compilerInitialized, CompilerInitialized,
270270
OnVar |
271+
UserInaccessible |
271272
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
272273
35)
273274
CONTEXTUAL_SIMPLE_DECL_ATTR(__consuming, Consuming,
@@ -727,6 +728,7 @@ DECL_ATTR(_backDeploy, BackDeploy,
727728

728729
CONTEXTUAL_SIMPLE_DECL_ATTR(_local, KnownToBeLocal,
729730
DeclModifier | OnFunc | OnParam | OnVar |
731+
UserInaccessible |
730732
ABIBreakingToAdd | ABIBreakingToRemove |
731733
APIBreakingToAdd | APIBreakingToRemove,
732734
130)

include/swift/AST/DiagnosticsCommon.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ NOTE(note_typo_candidate,none,
9090
NOTE(profile_read_error,none,
9191
"failed to load profile data '%0': '%1'", (StringRef, StringRef))
9292

93-
WARNING(protocol_extension_redundant_requirement,none,
94-
"requirement of '%1' to '%2' is redundant in an extension of '%0'",
95-
(StringRef, StringRef, StringRef))
96-
9793
ERROR(attr_only_on_parameters, none,
9894
"'%0' may only be used on parameters", (StringRef))
9995

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,10 +2477,6 @@ ERROR(requires_not_suitable_archetype,none,
24772477
"type %0 in conformance requirement does not refer to a "
24782478
"generic parameter or associated type",
24792479
(Type))
2480-
WARNING(requires_no_same_type_archetype,none,
2481-
"neither type in same-type constraint (%0 or %1) refers to a "
2482-
"generic parameter or associated type",
2483-
(Type, Type))
24842480

24852481
ERROR(requires_generic_params_made_equal,none,
24862482
"same-type requirement makes generic parameters %0 and %1 equivalent",
@@ -2494,71 +2490,32 @@ ERROR(recursive_generic_signature,none,
24942490
"%0 %1 has self-referential generic requirements", (DescriptiveDeclKind, DeclBaseName))
24952491
ERROR(recursive_generic_signature_extension,none,
24962492
"extension of %0 %1 has self-referential generic requirements", (DescriptiveDeclKind, DeclBaseName))
2497-
ERROR(recursive_same_type_constraint,none,
2498-
"same-type constraint %0 == %1 is recursive", (Type, Type))
2499-
ERROR(recursive_superclass_constraint,none,
2500-
"superclass constraint %0 : %1 is recursive", (Type, Type))
2501-
ERROR(requires_generic_param_same_type_does_not_conform,none,
2502-
"same-type constraint type %0 does not conform to required protocol %1",
2503-
(Type, Identifier))
2504-
ERROR(same_type_does_not_inherit,none,
2505-
"same-type constraint type %0 does not inherit from required superclass %1",
2506-
(Type, Type))
25072493
ERROR(requires_same_concrete_type,none,
25082494
"generic signature requires types %0 and %1 to be the same", (Type, Type))
25092495
WARNING(redundant_conformance_constraint,none,
25102496
"redundant conformance constraint %0 : %1", (Type, ProtocolDecl *))
2511-
NOTE(redundant_conformance_here,none,
2512-
"conformance constraint %0 : %1 implied here",
2513-
(Type, ProtocolDecl *))
25142497

25152498
WARNING(missing_protocol_refinement, none,
25162499
"protocol %0 should be declared to refine %1 due to a same-type constraint on 'Self'",
25172500
(ProtocolDecl *, ProtocolDecl *))
25182501

2519-
ERROR(same_type_conflict,none,
2520-
"%select{generic parameter |protocol |}0%1 cannot be equal to both "
2521-
"%2 and %3", (unsigned, Type, Type, Type))
25222502
ERROR(requirement_conflict,none,
25232503
"no type for %0 can satisfy both %1",
25242504
(Type, StringRef))
25252505
WARNING(redundant_same_type_to_concrete,none,
25262506
"redundant same-type constraint %0 == %1", (Type, Type))
2527-
NOTE(same_type_redundancy_here,none,
2528-
"same-type constraint %1 == %2 %select{written here|implied here|"
2529-
"inferred from type here}0",
2530-
(unsigned, Type, Type))
25312507
ERROR(conflicting_superclass_constraints,none,
25322508
"type %0 cannot be a subclass of both %1 and %2",
25332509
(Type, Type, Type))
2534-
NOTE(conflicting_superclass_constraint,none,
2535-
"constraint conflicts with %0 : %1",
2536-
(Type, Type))
25372510
WARNING(redundant_superclass_constraint,none,
25382511
"redundant superclass constraint %0 : %1", (Type, Type))
2539-
NOTE(superclass_redundancy_here,none,
2540-
"superclass constraint %0 : %1 implied here",
2541-
(Type, Type))
25422512

2543-
ERROR(conflicting_layout_constraints,none,
2544-
"type %0 has conflicting constraints %1 and %2",
2545-
(Type, LayoutConstraint, LayoutConstraint))
2546-
NOTE(conflicting_layout_constraint, none,
2547-
"constraint conflicts with %0 : %1",
2548-
(Type, LayoutConstraint))
25492513
WARNING(redundant_layout_constraint,none,
25502514
"redundant constraint %0 : %1",
25512515
(Type, LayoutConstraint))
2552-
NOTE(previous_layout_constraint, none,
2553-
"constraint %0 : %1 implied here",
2554-
(Type, LayoutConstraint))
25552516

25562517
WARNING(redundant_same_type_constraint,none,
25572518
"redundant same-type constraint %0 == %1", (Type, Type))
2558-
NOTE(previous_same_type_constraint, none,
2559-
"previous same-type constraint %1 == %2 "
2560-
"%select{written here|implied here|inferred from type here}0",
2561-
(unsigned, Type, Type))
25622519

25632520
WARNING(inherited_associated_type_redecl,none,
25642521
"redeclaration of associated type %0 from protocol %1 is better "

0 commit comments

Comments
 (0)