mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
- Any is made into a keyword which is always resolved into a TypeExpr, allowing the removal of the type system code to find TheAnyType before an unconstrained lookup. - Types called `Any` can be declared, they are looked up as any other identifier is - Renaming/redefining behaviour of source loc methods on ProtocolCompositionTypeRepr. Added a createEmptyComposition static method too. - Code highlighting treats Any as a type - simplifyTypeExpr also does not rely on source to get operator name. - Any is now handled properly in canParseType() which was causing generic param lists containing ‘Any’ to fail - The import objc id as Any work has been relying on getting a decl for the Any type. I fix up the clang importer to use Context.TheAnyType (instead of getAnyDecl()->getDeclaredType()). When importing the id typedef, we create a typealias to Any and declare it unavaliable.
17 lines
574 B
Swift
17 lines
574 B
Swift
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
|
|
|
|
func markUsed<T>(_ t: T) {}
|
|
|
|
func main() {
|
|
// CHECK: call void @llvm.dbg.declare(metadata %Any* {{.*}}, metadata ![[S:.*]], metadata !{{[0-9]+}}), !dbg ![[DBG:.*]]
|
|
// CHECK: ![[SCOPE:.*]] = distinct !DILexicalBlock({{.*}}line: 5, column: 13)
|
|
// CHECK: ![[S]] = !DILocalVariable(name: "s", {{.*}}line: [[@LINE+2]]
|
|
// CHECK: ![[DBG]] = !DILocation(line: [[@LINE+1]], column: 7, scope: ![[SCOPE]])
|
|
var s: Any = "hello world"
|
|
var n: Any = 12
|
|
var t: Any = (1,2)
|
|
markUsed("hello world")
|
|
}
|
|
|
|
main()
|