Implicit cast in pattern matching switch. #9430
Answered
by
HaloFour
The-Futurist
asked this question in
Language Ideas
Replies: 2 comments 1 reply
-
var newnode = statement switch
{
JuliaParser.ScopeStatementContext stmt => CreateScopeStatement(stmt),
JuliaParser.StructStatementContext stmt => CreateStructStatement(stmt),
JuliaParser.Proc_statementContext stmt => CreateProcedureStatement(stmt),
_ => new AstNode()
}; |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
The-Futurist
-
It would be a highly breaking change, as it could change what overload resolution determines is the most applicable method for anything that uses |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Look at this fragment:
The first match does not compile but perhaps it could? it seems safe to cast
statement
to the type automatically - or am I missing something?Beta Was this translation helpful? Give feedback.
All reactions