Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

[SE-0046] Implemented consistent function labels #8

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
// -----------------------------------------------------------------------------
func foo<T>(x: T) {
func foo<T>(_ x: T) {
print("break here")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class Accumulator {
_total = 0
}

func incr (x : Int) -> (Int, Int) {
func incr (_ x : Int) -> (Int, Int) {
var ret = (_total,0)
_total += x
ret.1 = _total
return ret
}

func decr (x : Int) -> (Int, Int) {
func decr (_ x : Int) -> (Int, Int) {
return incr(-x)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// -----------------------------------------------------------------------------
import Foundation

func main<T>(x: T) {
func main<T>(_ x: T) {
var k = NSString.self
print("Set breakpoint here")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
// -----------------------------------------------------------------------------
func foo(arg1: Int, _ arg2: String) -> Int {
func foo(_ arg1: Int, _ arg2: String) -> Int {
return 12 // break here
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// -----------------------------------------------------------------------------


func foo(x: Int, _ y: Int) -> Int {
func foo(_ x: Int, _ y: Int) -> Int {
return x - y + 1 // Set breakpoint here
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public struct S {
public init() {}
}

public func fA(x: S) -> Int {
public func fA(_ x: S) -> Int {
return x.f()
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ extension S {
}
}

public func fB(x: S) -> Int {
public func fB(_ x: S) -> Int {
return x.f()
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class ClassError : ErrorProtocol
{
m_message = message
}
func SomeMethod (input : Int)
func SomeMethod (_ input : Int)
{
print (m_message) // Set a breakpoint here to test method contexts
}
}

func IThrowEnumOver10(input : Int) throws -> Int
func IThrowEnumOver10(_ input : Int) throws -> Int
{
if input > 100
{
Expand All @@ -47,7 +47,7 @@ func IThrowEnumOver10(input : Int) throws -> Int
}
}

func IThrowObjectOver10(input : Int) throws -> Int
func IThrowObjectOver10(_ input : Int) throws -> Int
{
if input > 100
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct S<T> : HasSomething
}
}

func a (i : Int)
func a (_ i : Int)
{
var x = i // breakpoint 1
}
Expand All @@ -53,7 +53,7 @@ class B
m_s = S<Int>(in_t: 2)
}

func b (i : Int)
func b (_ i : Int)
{
var x = i // breakpoint 2
m_t = i
Expand All @@ -73,7 +73,7 @@ class C<T>
m_s = S<T>(in_t: input)
}

func c (i : T)
func c (_ i : T)
{
var x = i // breakpoint 3
m_t = i
Expand All @@ -82,7 +82,7 @@ class C<T>

// Generic function

func d<U> (i : U)
func d<U> (_ i : U)
{
var x = i // breakpoint 4
}
Expand All @@ -100,7 +100,7 @@ class E
m_s = S<Int>(in_t : 5)
}

func e<U> (i : U)
func e<U> (_ i : U)
{
var x = i // breakpoint 5
m_t = 6
Expand All @@ -120,7 +120,7 @@ class F<T>
m_s = S<T>(in_t: input)
}

func f<U> (i : T, _ j : U)
func f<U> (_ i : T, _ j : U)
{
var x = i
var y = j // breakpoint 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// -----------------------------------------------------------------------------
public protocol Foo
{
func foo(x: Int) -> Int
func foo(_ x: Int) -> Int
}

struct FooishStruct : Foo
{
func foo(x: Int) -> Int
func foo(_ x: Int) -> Int
{
return x + FooishStruct.cvar
}
Expand All @@ -29,7 +29,7 @@ struct FooishStruct : Foo

class FooishClass : Foo
{
func foo(x: Int) -> Int
func foo(_ x: Int) -> Int
{
return x + FooishStruct.cvar
}
Expand All @@ -48,7 +48,7 @@ enum FooishEnum : Int, Foo
var x : Int {return 10}
var y : String { return "Hello world"}

func foo(x: Int) -> Int
func foo(_ x: Int) -> Int
{
return x + FooishEnum.cvar
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class A
}
}

class func static_method (input : Int)
class func static_method (_ input : Int)
{
print("Got input: \(input) and ten: \(self.return_ten())") // In class function
}
Expand Down Expand Up @@ -85,13 +85,13 @@ class A
print ("In deinit.")
}

func shadow_a (input : Int) -> Void
func shadow_a (_ input : Int) -> Void
{
var in_class_a = 10.0
print("Got input: \(input) shadower: \(in_class_a) shadowed: \(self.in_class_a) and also_in_a: \(also_in_a) and through self: \(self.also_in_a)") // Shadowed in A
}

func DefinesClosure (a_string : String) -> () -> String
func DefinesClosure (_ a_string : String) -> () -> String
{
return { [unowned self] in
var tmp_string = a_string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class A
y = float
}

func do_something (input: Int64) -> Int64
func do_something (_ input: Int64) -> Int64
{
return x * input;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class B
{
class func b (i : Int)
class func b (_ i : Int)
{
var x = i // breakpoint 1
}
Expand All @@ -24,7 +24,7 @@ class B

class C<T>
{
class func c (i : T)
class func c (_ i : T)
{
var x = i // breakpoint 2
}
Expand All @@ -34,7 +34,7 @@ class C<T>

class E
{
class func e<U> (i : U)
class func e<U> (_ i : U)
{
var x = i // breakpoint 3
}
Expand All @@ -44,7 +44,7 @@ class E

class F<T>
{
class func f<U> (i : T, _ j : U)
class func f<U> (_ i : T, _ j : U)
{
var x = i
var y = j // breakpoint 4
Expand All @@ -53,23 +53,23 @@ class F<T>

struct G
{
static func g(i : Int)
static func g(_ i : Int)
{
var x = i // breakpoint 5
}
}

struct H<T>
{
static func h(i : T)
static func h(_ i : T)
{
var x = i // breakpoint 6
}
}

struct K<T>
{
static func k<U> (i: T, _ j : U)
static func k<U> (_ i: T, _ j : U)
{
var x = i
var y = j // breakpoint 7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class BlubbyUbby<T>
//% self.expect('expr -d run -- self', substrs=['3735928559'])
//% self.expect('fr var -d run -- self', substrs=['3735928559'])

func change_string (in_string : String)
func change_string (_ in_string : String)
{
my_string = in_string
}

func change_t (in_t : T)
func change_t (_ in_t : T)
{
my_t = in_t
}
Expand Down
6 changes: 3 additions & 3 deletions packages/Python/lldbsuite/test/lang/swift/generics/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extension String : Proto {
func get() -> Int { return 1 }
}

func function <SomeType : Proto> (x : SomeType)
func function <SomeType : Proto> (_ x : SomeType)
{
var v = x.get()
print(v) //Break here
Expand All @@ -29,11 +29,11 @@ func function <SomeType : Proto> (x : SomeType)
class AClass <TypeA>
{
init () {}
func method1(x : TypeA)
func method1(_ x : TypeA)
{
print("hello world") //Break here
}
func method2 <TypeB> (x : TypeA, _ y : TypeB)
func method2 <TypeB> (_ x : TypeA, _ y : TypeB)
{
print("Hello world") //Break here
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
// -----------------------------------------------------------------------------
func foo<T>(x: T) -> () {
func foo<T>(_ x: T) -> () {
print(x)
return print("break here")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class C {}
class D : C {}
protocol P {}

func main<T>(x: T) {
func main<T>(_ x: T) {
var s = String.self
var c = D.self
var t = (1,2,"hello").dynamicType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import Foundation

func someAPI(x : Int, _ y : Int) -> (String, NSError) {
func someAPI(_ x : Int, _ y : Int) -> (String, NSError) {
if (x == 0 && y == 0) {
return (" ",NSError(domain: "lldbrocks",code: 0xBABEFEED, userInfo: ["x":x,"y":y]))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum SillyEvent : Event {
case Goofus
}

func doStuff<T>(event: T) -> T {
func doStuff<T>(_ event: T) -> T {
return event // Set breakpoint here
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Generic<T> {
let b = 12
}

func foo<T0>(x: Generic<T0>) {
func foo<T0>(_ x: Generic<T0>) {
print(x) //% self.expect('frame variable -d run -- x', substrs=['"Hello world"', '12'])
//% self.expect('expression -d run -- x', substrs=['"Hello world"', '12'])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct Continuation<A> {

public typealias ContinuationU = Continuation<()>

public func sequence_<A>(xs: [Continuation<A>]) -> ContinuationU {
public func sequence_<A>(_ xs: [Continuation<A>]) -> ContinuationU {
return ContinuationU(f: nil, failable: {
for x in xs {
if x.run() != nil { //% self.expect('frame variable -d run -- x', substrs=['magicToken = "Hello World"', 'f = nil', 'failable = nil', 'perfMetric = nil'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum Generic<T> {
case Case3
}

func foo<T0>(x: Generic<T0>) {
func foo<T0>(_ x: Generic<T0>) {
print(x) //% self.expect('frame variable -d run -- x', substrs=['Case1'])
//% self.expect('frame variable -d run -- x', substrs=['Case2'], matching=False)
//% self.expect('frame variable -d run -- x', substrs=['Case3'], matching=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Generic<T> {
let b = 12
}

func foo<T0>(x: Generic<T0>) {
func foo<T0>(_ x: Generic<T0>) {
print(x) //% self.expect('frame variable -d run -- x', substrs=['"Hello world"', '12'])
//% self.expect('expression -d run -- x', substrs=['"Hello world"', '12'])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
// -----------------------------------------------------------------------------
func foo(x: Int, y: Int, z: Int) -> Int {
func foo(_ x: Int, y: Int, z: Int) -> Int {
return x + y - z
}

Expand Down
Loading