mirror of
https://github.com/github/codeql.git
synced 2026-04-19 05:54:00 +02:00
53 lines
984 B
Swift
53 lines
984 B
Swift
class Foo {
|
|
init() {}
|
|
func instanceMethod() {}
|
|
static func staticMethod() {}
|
|
class func classMethod() {}
|
|
}
|
|
|
|
actor Bar {
|
|
init() {}
|
|
func instanceMethod() {}
|
|
static func staticMethod() {}
|
|
}
|
|
|
|
@MainActor
|
|
class Baz {
|
|
init() {}
|
|
func instanceMethod() {}
|
|
static func staticMethod() {}
|
|
class func classMethod() {}
|
|
}
|
|
|
|
do {
|
|
let foo = Foo()
|
|
_ = Foo.init()
|
|
|
|
foo.instanceMethod()
|
|
Foo.instanceMethod(foo)()
|
|
|
|
Foo.classMethod()
|
|
Foo.staticMethod()
|
|
}
|
|
|
|
Task {
|
|
let bar = Bar()
|
|
_ = Bar.init()
|
|
|
|
await bar.instanceMethod()
|
|
// Bar.instanceMethod(bar2)() // error: actor-isolated instance method 'instanceMethod()' can not be referenced from a non-isolated context
|
|
|
|
Bar.staticMethod()
|
|
}
|
|
|
|
Task {
|
|
let baz = await Baz()
|
|
_ = await Baz.init()
|
|
|
|
await baz.instanceMethod() // DotSyntaxCallExpr
|
|
await Baz.instanceMethod(baz)() // DotSyntaxBaseIgnoredExpr
|
|
|
|
await Baz.classMethod()
|
|
await Baz.staticMethod()
|
|
}
|