Skip to content

Conversation

@artemcm
Copy link
Contributor

@artemcm artemcm commented May 14, 2025

Syntactically verify that initializer expressions of @const variables and argument expressions to @const parameters consist strictly of syntactically-verifiable set of basic values and operations.

Adds experimental feature CompileTimeValuesPreview which will disable syntactic verification and leave the contents of @const expressions up to downstream evaluation capabilities.

@artemcm
Copy link
Contributor Author

artemcm commented May 14, 2025

@swift-ci test

@nkcsgexi
Copy link
Contributor

Woohoo!

@artemcm
Copy link
Contributor Author

artemcm commented May 15, 2025

@swift-ci test

@kubamracek
Copy link
Contributor

This is very cool!

@kubamracek
Copy link
Contributor

@swift-ci test

@artemcm artemcm force-pushed the ConstSyntacticVerify branch from df1eef9 to 30afce2 Compare May 19, 2025 23:50
@artemcm
Copy link
Contributor Author

artemcm commented May 19, 2025

@swift-ci test

@kubamracek kubamracek requested review from jckarter and tbkka May 20, 2025 16:29
… in '@const' contexts

Syntactically verify that initializer expressions of '@const' variables and argument expressions to '@const' parameters consist strictly of syntactically-verifiable set of basic values and operations
@artemcm artemcm force-pushed the ConstSyntacticVerify branch from 30afce2 to d8176a7 Compare May 20, 2025 16:38
@artemcm
Copy link
Contributor Author

artemcm commented May 20, 2025

@swift-ci test

@const let constGlobal5: (Int, Float) = (42, 42.0)
@const let constGlobal7: (UInt64, StaticString, @convention(c) ()->Int) = (42, "hi", { return 42 })

// Closure call not supported in syntactically-validated mode
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is not a closure call, but just a closure reference

@artemcm artemcm merged commit 24f2975 into swiftlang:main May 21, 2025
5 checks passed
@artemcm artemcm deleted the ConstSyntacticVerify branch May 21, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants