Skip to content

Commit 1a6cc02

Browse files
authored
Merge pull request #10389 from augusto2112/fix-opaque-test
[lldb] Add global opaque archetype test
2 parents eca717f + 436002a commit 1a6cc02

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

lldb/test/API/lang/swift/opaque_return/TestBoundOpaqueArchetype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ def test(self):
1111
"""Tests that a type bound to an opaque archetype can be resolved correctly"""
1212
self.build()
1313
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.swift"))
14-
self.expect("v s", substrs=["S<", "opaque return type of", "f()"])
14+
self.expect("v s", substrs=["a.S<a.C>"])
1515
self.expect("po s", substrs=["S<C>"])
1616

lldb/test/API/lang/swift/opaque_return/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func f() -> some P {
1111
return p
1212
}
1313

14+
let v = f()
1415
let s = S(t: f())
1516
print(s) // break here
1617

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SWIFT_SOURCES := main.swift
2+
include Makefile.rules
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
7+
class TestSwiftGlobalOpaque(TestBase):
8+
9+
@swiftTest
10+
def test(self):
11+
"""Tests that a type bound to an opaque archetype can be resolved correctly"""
12+
self.build()
13+
self.runCmd("settings set symbols.swift-enable-ast-context false")
14+
15+
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.swift"))
16+
17+
self.expect("v v", substrs=["a.C", "i = 42"])
18+
self.expect("v s", substrs=["a.S<a.C>", "t = ", "i = 42"])
19+
20+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
protocol P {}
2+
3+
class C: P {
4+
let i = 42
5+
}
6+
7+
struct S<T> {
8+
let t: T
9+
}
10+
func f() -> some P {
11+
let p: some P = C()
12+
return p
13+
}
14+
15+
let v = f()
16+
let s = S(t: f())
17+
print(s) // break here
18+
19+
20+

0 commit comments

Comments
 (0)