Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8307] Compatibility fails when assigning to string view #50835

Open
masters3d opened this issue Jul 18, 2018 · 2 comments
Open

[SR-8307] Compatibility fails when assigning to string view #50835

masters3d opened this issue Jul 18, 2018 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. source compatibility standard library Area: Standard library umbrella

Comments

@masters3d
Copy link
Contributor

Previous ID SR-8307
Radar None
Original Reporter @masters3d
Type Bug
Environment

4.2

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, SourceCompatibility
Assignee @airspeedswift
Priority Medium

md5: 38ab09fb3f16597678c08498a3f87a93

Issue Description:

Worked in 4.0 and 4.1

```

var mycharacters = "abc".characters

mycharacters = mycharacters .dropFirst() // Fails now in 4.2 compiler in compatibility mode 4.1, 4.0print(Array(mycharacters )) // It print ["b", "c"]

```

apple/swift-source-compat-suite#192 (comment)

@belkadan
Copy link
Contributor

cc @milseman, @airspeedswift

@airspeedswift
Copy link
Member

It's because of the change to switch `CharacterView` to be an alias for `String`. I think I can switch it to be an alias for `Substring` instead to resolve this, should be similarly compatible.

Note:

  • this isn't 4.2, it's master (but does break the 4.0/4.2 modes)

  • `.characters` will be gone in 5.0 eventually (but still needs to work in those modes)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. source compatibility standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

3 participants