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-11238] Swift REPL: Cannot use custom operators #4331

Closed
swift-ci opened this issue Jul 30, 2019 · 2 comments
Closed

[SR-11238] Swift REPL: Cannot use custom operators #4331

swift-ci opened this issue Jul 30, 2019 · 2 comments
Labels

Comments

@swift-ci
Copy link

Previous ID SR-11238
Radar rdar://problem/53764712
Original Reporter palle (JIRA User)
Type Bug
Status Resolved
Resolution Won't Do
Environment

Swift version 5.1 (swiftlang-1100.0.266.1 clang-1100.0.32.1)

Xcode 11.0 beta 5 (11M382q)

Additional Detail from JIRA
Votes 0
Component/s Compiler, LLDB for Swift
Labels Bug, REPL
Assignee palle (JIRA)
Priority Medium

md5: 2e2d01366b8623d39ed240c9b4a45bc9

Issue Description:

When the user declares a custom operator in the REPL, the operator is not defined in subsequent statements.

Steps to reproduce:

  1. Open a terminal

  2. Type in swift and press return to start the REPL

  3. Type in postfix operator % and press return to declare an operator

  4. Type in

postfix func %(value: Int) -> Int {
    value * 100
} 

and press return to define an implementation for this newly defined operator.

Expected results:

This should work

Actual results:

The following compiler error occurs:

error: repl.swift:11:14: error: operator implementation without matching operator declaration
postfix func %(value: Int) -> Int { 

Notes:

Any prefix, infix or postfix operator that is manually defined, is affected by this issue.

This issue is also reproducible in Swift Playgrounds if the operator declaration is executed separately from the implementation or call.

@belkadan
Copy link

Hm, operators don't go through normal name lookup, so maybe they need special handling?

@swift-ci create

@xedin
Copy link
Member

xedin commented Apr 3, 2021

Unfortunately REPL is no longer supported by swift executable.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants