[swift-dev] Starter project: SR-2: Build configuration directives can not wrap switch cases

Dmitri Gribenko gribozavr at gmail.com
Sun Dec 6 17:04:34 CST 2015


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 at gmail.com>*/


More information about the swift-dev mailing list