mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Compile Time Constant Extraction] Emit underlying types for typealias types
Resolves rdar://113402135
This commit is contained in:
@@ -71,6 +71,7 @@ std::string toFullyQualifiedTypeNameString(const swift::Type &Type) {
|
||||
Options.AlwaysDesugarArraySliceTypes = true;
|
||||
Options.AlwaysDesugarDictionaryTypes = true;
|
||||
Options.AlwaysDesugarOptionalTypes = true;
|
||||
Options.PrintTypeAliasUnderlyingType = true;
|
||||
Options.OpaqueReturnTypePrinting =
|
||||
PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword;
|
||||
Type.print(OutputStream, Options);
|
||||
|
||||
@@ -321,7 +321,7 @@ extension String: Foo {}
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "label": "tuple3",
|
||||
// CHECK-NEXT: "type": "Swift.Void",
|
||||
// CHECK-NEXT: "type": "()",
|
||||
// CHECK-NEXT: "mangledTypeName": "n/a - deprecated",
|
||||
// CHECK-NEXT: "isStatic": "false",
|
||||
// CHECK-NEXT: "isComputed": "false",
|
||||
|
||||
20
test/ConstExtraction/ExtractTypeAliasUnderlyingType.swift
Normal file
20
test/ConstExtraction/ExtractTypeAliasUnderlyingType.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: echo "[MyProto]" > %t/protocols.json
|
||||
|
||||
// RUN: %target-swift-frontend -typecheck -emit-const-values-path %t/ExtractTypeAliasUnderlyingType.swiftconstvalues -const-gather-protocols-file %t/protocols.json -primary-file %s
|
||||
// RUN: cat %t/ExtractTypeAliasUnderlyingType.swiftconstvalues 2>&1 | %FileCheck %s
|
||||
|
||||
protocol MyProto {}
|
||||
|
||||
public struct SomeStruct {
|
||||
typealias SomeTypeAlias = String
|
||||
}
|
||||
|
||||
public struct Foo: MyProto {
|
||||
var name: SomeStruct.SomeTypeAlias?
|
||||
}
|
||||
|
||||
// CHECK: "properties": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "label": "name",
|
||||
// CHECK-NEXT: "type": "Swift.Optional<Swift.String>",
|
||||
Reference in New Issue
Block a user