comment whitespace#33
Merged
tkremenek merged 1 commit intoswiftlang:masterfrom Dec 3, 2015
Merged
Conversation
slavapestov
pushed a commit
to slavapestov/swift
that referenced
this pull request
Nov 27, 2018
…e_fixes Fixes to enable DISPATCH_DEBUG on Linux
slavapestov
pushed a commit
to slavapestov/swift
that referenced
this pull request
Nov 27, 2018
…e_fixes Fixes to enable DISPATCH_DEBUG on Linux Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
DougGregor
pushed a commit
to DougGregor/swift
that referenced
this pull request
Apr 28, 2024
externalize RPM metadata and make it version based
miku1958
pushed a commit
to miku1958/swift
that referenced
this pull request
May 4, 2026
…o-fix-it Implements proposal §"Containers and extensions" + decision row swiftlang#21 / swiftlang#33 for the container axis. `let xs: [String|Int] = zs` (with `zs: [Int|String]`) now reports error: cannot assign value of type '[Int | String]' to type '[String | Int]' note: arguments to generic parameter 'Element' ('Int | String' and 'String | Int') are expected to be equal fix-it: ^ as [String | Int] with an `as` (not `as!`) fix-it, since cross-spelling reshape is a runtime-free relabel — both sides erase to the same Any-singleton element layout, so SIL emits a single `unchecked_addr_cast` for the coercion. Two changes: - `matchDeepEqualityTypes`'s NarrowedAnyType branch detects the cross-spelling case (canonical leaf sets equal but spellings differ) before the leaf-by-leaf Bind. When the locator path carries an `AnyRequirement` element (e.g. `extension Array where Element == X | Y` dispatch checking a substituted `Element` of a different spelling), fix the same-type requirement directly via `fixRequirementFailure` so SameTypeRequirementFailure prints the full narrowed-Any spellings instead of the buggy `any Int` / `any String` fallout from the previous malformed-wrap path. For the plain conversion case, fall through to the leaf-by-leaf Bind but tag each leaf locator with a fresh `GenericArgument` element so `repairFailures` doesn't inherit `ExistentialConstraintType` from the enclosing existential match (which used to construct the malformed `ExistentialType::get(<concrete leaf>)` wrap that defeated upstream `GenericArgumentsMismatch` recording). - `ContextualFailure::tryTypeCoercionFixIt` recognises cross-spelling NarrowedAnyType at container position structurally (same generic decl, every generic arg either equal or cross-spelling-equal NarrowedAnyType) and emits the ` as <toType>` fix-it directly, bypassing the generic `typeCheckCheckedCast` path which would classify it as ArrayDowncast (and suggest the wrong `as!` direction). Restricted to the `BoundGenericType` case so the value-level `Int|String → String|Int` path keeps using the existing `typeCheckCheckedCast → Coercion` flow with both `as` and `as!` fix-its preserved unchanged. `diagnostics.swift §13` locks the full diagnostic text, the generic-parameter-mismatch note, and the fix-it insertion. lit 13/13.
miku1958
pushed a commit
to miku1958/swift
that referenced
this pull request
May 4, 2026
…o-fix-it Implements proposal §"Containers and extensions" + decision row swiftlang#21 / swiftlang#33 for the container axis. `let xs: [String|Int] = zs` (with `zs: [Int|String]`) now reports error: cannot assign value of type '[Int | String]' to type '[String | Int]' note: arguments to generic parameter 'Element' ('Int | String' and 'String | Int') are expected to be equal fix-it: ^ as [String | Int] with an `as` (not `as!`) fix-it, since cross-spelling reshape is a runtime-free relabel — both sides erase to the same Any-singleton element layout, so SIL emits a single `unchecked_addr_cast` for the coercion. Two changes: - `matchDeepEqualityTypes`'s NarrowedAnyType branch detects the cross-spelling case (canonical leaf sets equal but spellings differ) before the leaf-by-leaf Bind. When the locator path carries an `AnyRequirement` element (e.g. `extension Array where Element == X | Y` dispatch checking a substituted `Element` of a different spelling), fix the same-type requirement directly via `fixRequirementFailure` so SameTypeRequirementFailure prints the full narrowed-Any spellings instead of the buggy `any Int` / `any String` fallout from the previous malformed-wrap path. For the plain conversion case, fall through to the leaf-by-leaf Bind but tag each leaf locator with a fresh `GenericArgument` element so `repairFailures` doesn't inherit `ExistentialConstraintType` from the enclosing existential match (which used to construct the malformed `ExistentialType::get(<concrete leaf>)` wrap that defeated upstream `GenericArgumentsMismatch` recording). - `ContextualFailure::tryTypeCoercionFixIt` recognises cross-spelling NarrowedAnyType at container position structurally (same generic decl, every generic arg either equal or cross-spelling-equal NarrowedAnyType) and emits the ` as <toType>` fix-it directly, bypassing the generic `typeCheckCheckedCast` path which would classify it as ArrayDowncast (and suggest the wrong `as!` direction). Restricted to the `BoundGenericType` case so the value-level `Int|String → String|Int` path keeps using the existing `typeCheckCheckedCast → Coercion` flow with both `as` and `as!` fix-its preserved unchanged. `diagnostics.swift §13` locks the full diagnostic text, the generic-parameter-mismatch note, and the fix-it insertion. lit 13/13.
miku1958
pushed a commit
to miku1958/swift
that referenced
this pull request
May 4, 2026
…o-fix-it Implements proposal §"Containers and extensions" + decision row swiftlang#21 / swiftlang#33 for the container axis. `let xs: [String|Int] = zs` (with `zs: [Int|String]`) now reports error: cannot assign value of type '[Int | String]' to type '[String | Int]' note: arguments to generic parameter 'Element' ('Int | String' and 'String | Int') are expected to be equal fix-it: ^ as [String | Int] with an `as` (not `as!`) fix-it, since cross-spelling reshape is a runtime-free relabel — both sides erase to the same Any-singleton element layout, so SIL emits a single `unchecked_addr_cast` for the coercion. Two changes: - `matchDeepEqualityTypes`'s NarrowedAnyType branch detects the cross-spelling case (canonical leaf sets equal but spellings differ) before the leaf-by-leaf Bind. When the locator path carries an `AnyRequirement` element (e.g. `extension Array where Element == X | Y` dispatch checking a substituted `Element` of a different spelling), fix the same-type requirement directly via `fixRequirementFailure` so SameTypeRequirementFailure prints the full narrowed-Any spellings instead of the buggy `any Int` / `any String` fallout from the previous malformed-wrap path. For the plain conversion case, fall through to the leaf-by-leaf Bind but tag each leaf locator with a fresh `GenericArgument` element so `repairFailures` doesn't inherit `ExistentialConstraintType` from the enclosing existential match (which used to construct the malformed `ExistentialType::get(<concrete leaf>)` wrap that defeated upstream `GenericArgumentsMismatch` recording). - `ContextualFailure::tryTypeCoercionFixIt` recognises cross-spelling NarrowedAnyType at container position structurally (same generic decl, every generic arg either equal or cross-spelling-equal NarrowedAnyType) and emits the ` as <toType>` fix-it directly, bypassing the generic `typeCheckCheckedCast` path which would classify it as ArrayDowncast (and suggest the wrong `as!` direction). Restricted to the `BoundGenericType` case so the value-level `Int|String → String|Int` path keeps using the existing `typeCheckCheckedCast → Coercion` flow with both `as` and `as!` fix-its preserved unchanged. `diagnostics.swift §13` locks the full diagnostic text, the generic-parameter-mismatch note, and the fix-it insertion. lit 13/13.
miku1958
pushed a commit
to miku1958/swift
that referenced
this pull request
May 4, 2026
Verify-mode tests for the strict-invariant rules already enforced by Sema (proposal §"Subtyping lattice"; row swiftlang#21 / row swiftlang#33). All three sections lock currently-passing rejections so wording / rule drift fails immediately: - §17 container narrowing — `[Int|String] -> [Int]`, `[String: Int|Bool] -> [String: Int]` (generic-arg-mismatch wording) - §18 disjoint container element sets — `[Int|String] -> [Bool|Double]` (no relabel can rescue, no fix-it) - §19 function-type variance — `(Int) -> Void -> (Int|String) -> Void` rejected; param-widening relaxation lives in the variance future direction phase2f_runtime.swift §1 already covers the positive widening direction (`[Int] -> [Int|String]` element-lift). Together with §13 (cross- spelling) and §15 (disjoint return), the variance verify-mode bed now covers the strict-invariant negatives that Sema currently rejects; remaining "should error but silently desugar to Any layout" cases (narrowed-Any -> [Any], function param-narrowing) require Sema work and stay open in workspace todo.md §四.
miku1958
pushed a commit
to miku1958/swift
that referenced
this pull request
May 4, 2026
…sses `Array<T>`/`Dictionary<K,V>`/`Set<T>` are invariant in narrowed-`Any` element positions per the proposal's "Subtyping lattice" rule, but the constraint solver's `ArrayUpcast`/`DictionaryUpcast`/`SetUpcast` restrictions used the caller's match kind for the inner element match — so a leaf-typed source array silently widened into a narrowed-`Any` element type, narrowed-`Any` arrays silently erased to `[Any]`, and `Set<Int>` silently widened to `Set<Int | String>`. Those three were the container axis of the v1 gap registered in §"Strict-invariant rule has silent passes". Fix: in each of the three Upcast cases, `Type::findIf` over the canonical tree of either side detects narrowed-`Any` and forces the inner match to `Bind`, so the leaf-injection / open-erasure subtype routes no longer fire. Explicit `as` coercion is exempted via the existing `isExplicitCoerce` idiom (anchor `dyn_cast<CoerceExpr>`), so cross-spelling reshape (`zs as [String | Int]`) and explicit widening (`xs as [Int | String]`) still go through the SIL paths exercised by `phase2_edge.swift §8` and `phase2f_runtime.swift §1`/§2. Test bed: - `diagnostics.swift §20` adds the three now-erroring shapes with `expected-error` + `expected-note` locks; `§17`'s comment is updated to point at `§20` for the symmetric widening direction. - `phase2f_runtime.swift §1` rewrites the MARK 1 example onto the explicit-cast form (per design decision row swiftlang#33), with the comment explaining why the per-element wrap is required (source element stride 8 bytes vs Any-singleton element stride 32 bytes). The fourth silent pass — function-type parameter contravariance narrowing a narrowed-`Any` parameter — still slips through `function_conversion`; that fix lives in `matchFunctionTypes` and is the remaining v1-blocking item for this gap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.