[swift-evolution] Disallowing unreachable code
Joe Groff
jgroff at apple.com
Wed Mar 29 19:07:40 CDT 2017
> On Mar 29, 2017, at 4:21 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>
>> On Mar 29, 2017, at 4:14 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>>
>>> On Mar 29, 2017, at 8:11 AM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
>>>
>>> I was suggesting that it would be a useful addition to the language, not that it
>>> necessarily needed new compiler support.
>>
>> Personally, what I'd like to see is for the existing <#whatever#> placeholder syntax to be treated as an unimplemented() call. That probably *would* require compiler support, although fortunately we already parse this syntax into an EditorPlaceholderExpr.
>
> Actually, looking more closely, we already have this behavior in playgrounds (and REPLs); it's only an error when you compile. Like, we literally do this:
>
> // Found it. Flag it as error (or warning, if in playground mode) for the
> // rest of the compiler pipeline and lex it as an identifier.
> if (LangOpts.Playground) {
> diagnose(TokStart, diag::lex_editor_placeholder_in_playground);
> } else {
> diagnose(TokStart, diag::lex_editor_placeholder);
> }
>
> Could we change the compile-time error into a warning? Would that require an evolution proposal?
Ah, you beat me to it. I would support reducing this to a warning.
-Joe
More information about the swift-evolution
mailing list