From 0d74709ca7175b02396530357bbc115a569bba6c Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Thu, 23 Jun 2022 17:35:00 +0200 Subject: [PATCH] Don't use DisplayNameCore for type name in augmentation. (#13335) --- src/Compiler/Checking/NicePrint.fs | 2 +- tests/fsharp/core/printing/output.1000.stdout.bsl | 4 ++-- tests/fsharp/core/printing/output.200.stdout.bsl | 4 ++-- tests/fsharp/core/printing/output.47.stdout.bsl | 4 ++-- tests/fsharp/core/printing/output.multiemit.stdout.bsl | 4 ++-- tests/fsharp/core/printing/output.off.stdout.bsl | 4 ++-- tests/fsharp/core/printing/output.stdout.bsl | 4 ++-- tests/fsharp/core/typeAugmentation/test.fsx | 8 ++++++++ tests/fsharp/tests.fs | 3 +++ 9 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 tests/fsharp/core/typeAugmentation/test.fsx diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 0df67a7ea..11a5cd7f2 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -1555,7 +1555,7 @@ module TastDefinitionPrinting = let layoutExtensionMember denv infoReader (vref: ValRef) = let (@@*) = if denv.printVerboseSignatures then (@@----) else (@@--) let tycon = vref.MemberApparentEntity.Deref - let nameL = ConvertNameToDisplayLayout (tagMethod >> mkNav vref.DefinitionRange >> wordL) tycon.DisplayNameCore + let nameL = layoutTyconRefImpl false denv vref.MemberApparentEntity let nameL = layoutAccessibility denv tycon.Accessibility nameL // "type-accessibility" let tps = match PartitionValTyparsForApparentEnclosingType denv.g vref.Deref with diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index 755d5849c..feddb3cb1 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -2621,9 +2621,9 @@ val x: optionRecord = { x = null } TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool = true diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index a3604d4f7..d44cc2180 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -1866,9 +1866,9 @@ val x: optionRecord = { x = null } TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool = true diff --git a/tests/fsharp/core/printing/output.47.stdout.bsl b/tests/fsharp/core/printing/output.47.stdout.bsl index 772dbe7da..94814735c 100644 --- a/tests/fsharp/core/printing/output.47.stdout.bsl +++ b/tests/fsharp/core/printing/output.47.stdout.bsl @@ -6166,9 +6166,9 @@ val x: optionRecord = { x = null } TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool = true diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 66fbbfc52..fa7ff16cf 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -6168,9 +6168,9 @@ val x: optionRecord = { x = null } TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool = true diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 261064ae5..a0c862724 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -1636,9 +1636,9 @@ val x: optionRecord TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 66fbbfc52..fa7ff16cf 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -6168,9 +6168,9 @@ val x: optionRecord = { x = null } TwoFields2: obj } -> type Int32 with +> type System.Int32 with member ExtrinsicExtensionProperty: int -type Int32 with +type System.Int32 with member ExtrinsicExtensionMethod: unit -> int > val ``value with spaces in name`` : bool = true diff --git a/tests/fsharp/core/typeAugmentation/test.fsx b/tests/fsharp/core/typeAugmentation/test.fsx new file mode 100644 index 000000000..cb46eb9f6 --- /dev/null +++ b/tests/fsharp/core/typeAugmentation/test.fsx @@ -0,0 +1,8 @@ +module Foo + +open System + +type Int32 with + member this.PlusPlus () = this + 1 + +let two = (1).PlusPlus() \ No newline at end of file diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 032b2cad2..eb4fbb87c 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -3370,6 +3370,9 @@ module GeneratedSignatureTests = [] let ``classStructInterface-FSC_NETFX_TEST_GENERATED_SIGNATURE`` () = singleTestBuildAndRun "core/classStructInterface" FSC_NETFX_TEST_GENERATED_SIGNATURE + + [] + let ``typeAugmentation-FSC_NETFX_TEST_GENERATED_SIGNATURE`` () = singleTestBuildAndRun "core/typeAugmentation" FSC_NETFX_TEST_GENERATED_SIGNATURE #endif #if !NETCOREAPP -- GitLab