mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Allow 'static' (or, in classes, final 'class') operators to be declared within types and extensions thereof. Within protocols, require operators to be marked 'static'. Use a warning with a Fix-It to stage this in, so we don't break the world's code. Protocol conformance checking already seems to work, so add some tests for that. Update a pile of tests and the standard library to include the required 'static' keywords. There is an amusing name-mangling change here. Global operators were getting marked as 'static' (for silly reasons), so their mangled names had the 'Z' modifier for static methods, even though this doesn't make sense. Now, operators within types and extensions need to be 'static' as written.
12 lines
540 B
Swift
12 lines
540 B
Swift
// This source file is part of the Swift.org open source project
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
// RUN: not %target-swift-frontend %s -parse
|
|
// This test fails in the AST verifier, which can be turned off.
|
|
// REQUIRES: swift_ast_verifier
|
|
class a<T where g:d{class A{class A<T>:A{init(){T{
|