Files
swift-mirror/test/attributes.swift
Doug Gregor 3d15bf3d55 Introduce a diagnostic-formatting engine and port most of the parser's
diagnostics over to it.

There are a few differences between this diagnostic engine and Clang's
engine:
  - Diagnostics are specified by a .def file (Diagnostics.def), rather
  than via tblgen, which drastically simplifies the build and makes
  code completion work when you add a new diagnostic.
  - Calls to the "diagnose()" method are safely typed based on the
  argument types specified in the .def file, so it's harder to write a
  diagnostic whose expected arguments (in the string) and whose actual
  arguments (in the code) don't match.
  - It uses variadic templates, so it hangs with the cool kids.



Swift SVN r734
2011-09-26 23:46:28 +00:00

13 lines
580 B
Swift

// RUN: %swift %s -verify
func [unknown] f0() {} // expected-error{{unknown attribute 'unknown'}}
func [.] f1() {} // expected-error{{expected an attribute name}}
oneof binary { Zero, One }
// Test infix_left attribute parsing
func [infix_left=300] +(binary, binary) {} // expected-error{{precedence '300' is not an integer between 0 and 255}}
func [infix_left=10,infix_left=20] ++(binary, binary) {} // expected-error{{duplicate 'infix_left' attribute}}
func [infix_left=right] +++(binary, binary) {} // expected-error{{expected precedence number in 'infix_left' attribute}}