Starter project: SR-2: Build configuration directives can not wrap switch cases


(Dmitri Gribenko) #1

Hi,

If you're looking for a starter project in the frontend area (parser
in this case), here is one.

https://bugs.swift.org/browse/SR-2

This code should be accepted, but it is rejected now:

switch 10 {
  case 10:
    break
#if FOO
  case 20:
    break
#endif
}

$ swiftc /tmp/a.swift
/tmp/a.swift:5:3: error: 'case' label can only appear inside a
'switch' statement
  case 20:
  ^

Dmitri

···

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(Meador Inge) #2

Hi,

If you're looking for a starter project in the frontend area (parser
in this case), here is one.

https://bugs.swift.org/browse/SR-2

This code should be accepted, but it is rejected now:

switch 10 {
  case 10:
    break
#if FOO
  case 20:
    break
#endif
}

$ swiftc /tmp/a.swift
/tmp/a.swift:5:3: error: 'case' label can only appear inside a
'switch' statement
  case 20:
  ^

I will take a look at this one.

Cheers,

-- Meador

···

On Sun, Dec 6, 2015 at 5:04 PM, Dmitri Gribenko via swift-dev < swift-dev@swift.org> wrote:


(Meador Inge) #3

Hi,

If you're looking for a starter project in the frontend area (parser
in this case), here is one.

https://bugs.swift.org/browse/SR-2

This code should be accepted, but it is rejected now:

switch 10 {
  case 10:
    break
#if FOO
  case 20:
    break
#endif
}

$ swiftc /tmp/a.swift
/tmp/a.swift:5:3: error: 'case' label can only appear inside a
'switch' statement
  case 20:
  ^

Quick question about this one.

As mentioned in SR-2, the current grammar for switch
statements [1] does not allow for compiler control
statements. So, fixing this involves a grammar
change.

I suspect that grammar changes will require a proposal
on the swift-evo list?

Cheers,

Meador

[1]
https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/switch-statement

···

On Sun, Dec 6, 2015 at 5:04 PM, Dmitri Gribenko via swift-dev < swift-dev@swift.org> wrote:


(Dmitri Gribenko) #4

I think this can be treated as a bug fix.

Dmitri

···

On Thu, Dec 17, 2015 at 7:58 AM, Meador Inge <meadori@gmail.com> wrote:

On Sun, Dec 6, 2015 at 5:04 PM, Dmitri Gribenko via swift-dev > <swift-dev@swift.org> wrote:

Hi,

If you're looking for a starter project in the frontend area (parser
in this case), here is one.

https://bugs.swift.org/browse/SR-2

This code should be accepted, but it is rejected now:

switch 10 {
  case 10:
    break
#if FOO
  case 20:
    break
#endif
}

$ swiftc /tmp/a.swift
/tmp/a.swift:5:3: error: 'case' label can only appear inside a
'switch' statement
  case 20:
  ^

Quick question about this one.

As mentioned in SR-2, the current grammar for switch
statements [1] does not allow for compiler control
statements. So, fixing this involves a grammar
change.

I suspect that grammar changes will require a proposal
on the swift-evo list?

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(Chris Lattner) #5

Agreed,

-Chris

···

On Dec 17, 2015, at 9:06 AM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

Quick question about this one.

As mentioned in SR-2, the current grammar for switch
statements [1] does not allow for compiler control
statements. So, fixing this involves a grammar
change.

I suspect that grammar changes will require a proposal
on the swift-evo list?

I think this can be treated as a bug fix.


(Meador Inge) #6

Thanks. What is the process for updating the grammar
in the documentation after the bug fix has been made?

-- Meador

···

On Thu, Dec 17, 2015 at 12:08 PM, Chris Lattner <clattner@apple.com> wrote:

On Dec 17, 2015, at 9:06 AM, Dmitri Gribenko via swift-dev < > swift-dev@swift.org> wrote:
>> Quick question about this one.
>>
>> As mentioned in SR-2, the current grammar for switch
>> statements [1] does not allow for compiler control
>> statements. So, fixing this involves a grammar
>> change.
>>
>> I suspect that grammar changes will require a proposal
>> on the swift-evo list?
>
> I think this can be treated as a bug fix.

Agreed,


(Chris Lattner) #7

We don’t have a really great process yet. Until we do, please just email me or another apple engineer and we can file an internal radar and route it to the right team. Alternatively, you can also file a bug through bugreporter.apple.com and we can help route it. Thanks!

-Chris

···

On Dec 17, 2015, at 10:19 AM, Meador Inge <meadori@gmail.com> wrote:

>> I suspect that grammar changes will require a proposal
>> on the swift-evo list?
>
> I think this can be treated as a bug fix.

Agreed,

Thanks. What is the process for updating the grammar
in the documentation after the bug fix has been made?