Skip to content

Conversation

ravikandhadai
Copy link
Contributor

@ravikandhadai ravikandhadai commented Jul 15, 2020

As of now, the sema checks for os_log allow only string interpolations to be passed to the log calls. E.g. logger.log(foo("message")) would not be allowed. This PR relaxes this requirement and allows it as long as foo is annotated as @_semantics("constant_evaluable").

However, as a special case, this PR still prevents calling the initializer of OSLogMessage, which is annotated constant_evaluable, to create the log message. E.g. logger.log(OSLogMessage(stringLiteral: "message")) would still be prevented. This is done to ensure that users who are new to the APIs do not reach out for the OSLogMessage initializer to construct a message (by looking at the type of the argument). OSLogMessage should be automatically created when passing string interpolations. So this condition is checked for and a diagnostic is emitted.

rdar://problem/65842243

@ravikandhadai ravikandhadai requested a review from a team as a code owner July 15, 2020 20:27
@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3578d681b286d5a53235f5ba421d25e46d2eafad

@ravikandhadai
Copy link
Contributor Author

This failure looks like some noise.

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test macOS Platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3578d681b286d5a53235f5ba421d25e46d2eafad

@ravikandhadai
Copy link
Contributor Author

This time the error is different and is in LLDB test suite: Swift/astcontext_error.test. This is also noise.

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please smoke test

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test macOS platform

@ravikandhadai ravikandhadai requested a review from guitard0g July 16, 2020 03:32
Copy link

@guitard0g guitard0g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

…e functions.

As of now, the sema checks for os_log allow only string interpolations to be passed
to the log calls. E.g. logger.log(foo("message")) would not be allowed. This PR
relaxes this requirement and allows it as long as foo is annotated as
@_semantics("constant_evaluable").

<rdar://problem/65842243>
@ravikandhadai ravikandhadai force-pushed the SwiftUIPreviewFix-5.3 branch from 3578d68 to d827f58 Compare July 20, 2020 19:57
@ravikandhadai
Copy link
Contributor Author

ravikandhadai commented Jul 20, 2020

Update the commit message to use the rdar problem for release/5.3

@ravikandhadai
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3578d681b286d5a53235f5ba421d25e46d2eafad

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3578d681b286d5a53235f5ba421d25e46d2eafad

@ravikandhadai ravikandhadai merged commit db53a37 into swiftlang:release/5.3 Jul 21, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🍒 release cherry pick Flag: Release branch cherry picks swift 5.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants