Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3912,7 +3912,7 @@ Parser::parseDecl(ParseDeclOptions Flags,
const bool IsProbablyFuncDecl =
Tok.isIdentifierOrUnderscore() || Tok.isAnyOperator();

if (IsProbablyFuncDecl) {
if (IsProbablyFuncDecl && (!peekToken().is(tok::period))) {

DescriptiveDeclKind DescriptiveKind;

Expand Down
19 changes: 19 additions & 0 deletions test/Parse/diagnostic_missing_func_keyword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

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

// RUN: %target-typecheck-verify-swift

struct SR13098 { // expected-note {{in declaration of 'SR13098'}}
var srValue = 0xABABABAB // expected-note {{'srValue' previously declared here}}
var a: Int

srValue = 0xCDCDCDCD // expected-error {{invalid redeclaration of 'srValue'}}
// expected-error @-1 {{expected 'var' keyword in property declaration}}


// ensure that the id.id pattern is not interpreted as a function
a.foo = 345 // expected-error {{expected declaration}}

// note that the expected declaration blocks further diagnostics up to
// the closing right brace.
srValue.bar = 345
}


protocol Brew { // expected-note {{in declaration of 'Brew'}}
tripel() -> Int // expected-error {{expected 'func' keyword in instance method declaration}} {{3-3=func }}

Expand Down