From 603b71dbda063fcf22d7746926c9e5b26854d594 Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Sat, 20 Jan 2018 12:47:50 +0100 Subject: [PATCH 01/15] Change error text. --- src/buildfromsource/FSharp.Compiler.Private/FSComp.resx | 2 +- src/fsharp/xlf/FSComp.txt.cs.xlf | 2 +- src/fsharp/xlf/FSComp.txt.de.xlf | 2 +- src/fsharp/xlf/FSComp.txt.en.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- src/fsharp/xlf/FSComp.txt.fr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.it.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ja.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ko.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pl.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ru.xlf | 2 +- src/fsharp/xlf/FSComp.txt.tr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx index 71f965fc9f..3dc83fbd02 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx @@ -1120,7 +1120,7 @@ The member or object constructor '{0}' is not {1} - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. {0} is not a static method diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 9cdaa6a18f..2935daad73 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Konstruktor členu nebo objektu {0} není {1}. K soukromým členům se dá přistupovat jenom z deklarujícího typu. K chráněným členům se dá přistupovat jenom z rozšiřujícího typu a nedá se k nim přistupovat z vnitřních výrazů lambda. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 7c73818288..71ea94d5e1 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Der Member oder Objektkonstruktor "{0}" ist nicht {1}. Auf private Member darf nur innerhalb des deklarierenden Typs zugegriffen werden. Auf geschützte Member darf nur von einem erweiternden Typ zugegriffen werden; der Zugriff von inneren lambda-Ausdrücken ist nicht zulässig. diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index 5e6faa804c..ce04f3b707 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index f9490c4c92..4752131b8b 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. El constructor de objeto o miembro '{0}' no es {1}. Los miembros privados solo son accesibles desde el tipo que los declara. Los miembros protegidos solo son accesibles desde un tipo de extensión y no son accesibles desde expresiones lambda internas. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 1219b7d427..4d42b75658 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Le membre ou le constructeur d'objet '{0}' n'est pas {1}. Les membres privés ne peuvent être accessibles qu'à partir du type déclarant. Les membres protégés ne peuvent être accessibles qu'à partir d'un type d'extension et ne sont pas accessibles à partir d'expressions lambda internes. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 6090bc62dd..fe43f55e80 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Il costruttore di oggetti o membro '{0}' non è {1}. È possibile accedere ai membri privati solo dall'interno del tipo dichiarante. I membri privati sono invece accessibili solo da un tipo di estensione e non da espressioni lambda interne. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 96e27fe596..e540822197 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. メンバーまたはオブジェクト コンストラクター '{0}' は {1} ではありません。プライベート メンバーには、宣言する型の中からのみアクセスできます。プロテクト メンバーには、拡張する型からのみアクセスでき、内部ラムダ式からアクセスすることはできません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index f1da0d44ac..94f9cad206 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. 멤버 또는 개체 생성자 '{0}'은(는) {1}이(가) 아닙니다. 전용 멤버는 선언 형식 내에서만 액세스할 수 있습니다. 보호된 멤버는 확장 형식에서만 액세스할 수 있으며 내부 람다 식에서는 액세스할 수 없습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 434d400d47..b00cddd507 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Element członkowski lub konstruktor obiektów „{0}” nie jest {1}. Prywatne elementy członkowskie mogą być dostępne tylko w obrębie typu deklarującego. Chronione elementy członkowskie mogą być dostępne tylko z poziomu typu rozszerzającego. Nie można uzyskać do nich dostępu z poziomu wewnętrznych wyrażeń lambda. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 683bb23f5a..5e5ac9d57d 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. O construtor de membro ou objeto '{0}' não é {1}. Membros particulares só podem ser acessados no tipo de declaração. Membros protegidos só podem ser acessados em um tipo de extensão e não podem ser acessados em expressões lambda internas. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 0e874b1122..d39d24730b 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Конструктор элемента или объекта "{0}" не является {1}. Закрытые элементы доступны только внутри типа, в котором они объявляются. Защищенные типы доступны только из расширяющего типа и недоступны из внутренних лямбда-выражений. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 8f5c3e3e6a..80d679464b 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. Üye veya nesne oluşturucu '{0}', {1} değil. Özel üyelere yalnızca tanımlayan türün içinden erişilebilir. Korunan üyelere yalnızca genişletilen bir türden erişilebilir, iç lambda ifadelerinden erişilemez. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 25518d7ef9..e42ee01bb0 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. 成员或对象构造函数“{0}”不是 {1}。只可以从声明类型中访问私有成员。只可以从扩展类型访问受保护的成员,而不能从内部 lambda 表达式访问这些成员。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index f63b4e2b65..5f8dcb8209 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -1668,7 +1668,7 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. 成員或物件建構函式 '{0}' 不是 {1}。私用成員只能從宣告類型中存取。受保護的成員只能從擴充類型存取,無法從內部 Lambda 運算式存取。 From 52391ed77b1f185d9d51b2e022961e44600f8ae0 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 22 Jan 2018 19:48:14 +0000 Subject: [PATCH 02/15] [CompilerPerf] make tuples support Item* with warning (#4034) * make tuples support Item* with warning * add deactivated tests for struct tuple * proper return types for Rest, prototype ctors * fix SRTP * fix tests * fix tests * add more protection * improve code for decompiling types * fix unit tests * don't rebuild * make infos systematic to reduce use of tcrefOfAppTy * update test cases * fix build * update test cases * bump FCS version consistently * use consistent names * code review --- .gitignore | 5 + fcs/README.md | 6 +- fcs/RELEASE_NOTES.md | 12 +- fcs/docsrc/content/ja/symbols.fsx | 4 +- fcs/docsrc/content/symbols.fsx | 4 +- fcs/fcs.props | 2 +- ...FSharp.Compiler.Service.MSBuild.v12.nuspec | 4 +- ...arp.Compiler.Service.ProjectCracker.nuspec | 4 +- fcs/nuget/FSharp.Compiler.Service.nuspec | 2 +- src/absil/il.fs | 46 +-- src/absil/il.fsi | 16 +- src/absil/ilmorph.fs | 8 +- src/absil/ilprint.fs | 12 +- src/absil/ilread.fs | 4 +- src/absil/ilreflect.fs | 14 +- src/absil/ilwrite.fs | 20 +- src/absil/ilx.fs | 2 +- src/absil/ilx.fsi | 2 +- .../FSharp.Compiler.Private/FSComp.fs | 4 + .../FSharp.Compiler.Private/FSComp.resx | 3 + src/fsharp/AccessibilityLogic.fs | 14 +- src/fsharp/AttributeChecking.fs | 26 +- src/fsharp/AugmentWithHashCompare.fs | 4 +- src/fsharp/CompileOps.fs | 6 +- src/fsharp/ConstraintSolver.fs | 25 +- src/fsharp/FSComp.txt | 1 + src/fsharp/IlxGen.fs | 54 +-- src/fsharp/InfoReader.fs | 187 +++++---- src/fsharp/MethodCalls.fs | 10 +- src/fsharp/MethodOverrides.fs | 22 +- src/fsharp/NameResolution.fs | 52 +-- src/fsharp/NicePrint.fs | 27 +- src/fsharp/Optimizer.fs | 12 +- src/fsharp/PatternMatchCompilation.fs | 8 +- src/fsharp/PostInferenceChecks.fs | 14 +- src/fsharp/QuotationTranslator.fs | 20 +- src/fsharp/TastOps.fs | 64 ++- src/fsharp/TastOps.fsi | 20 + src/fsharp/TastPickle.fs | 20 +- src/fsharp/TcGlobals.fs | 158 +++++--- src/fsharp/TypeChecker.fs | 65 +-- src/fsharp/fsc.fs | 4 +- src/fsharp/import.fs | 4 +- src/fsharp/infos.fs | 371 +++++++++++------- src/fsharp/service/ServiceAnalysis.fs | 2 +- src/fsharp/service/ServiceAssemblyContent.fs | 2 +- src/fsharp/service/ServiceDeclarationLists.fs | 14 +- .../service/ServiceInterfaceStubGenerator.fs | 4 +- src/fsharp/service/service.fs | 22 +- src/fsharp/symbols/Exprs.fs | 18 +- src/fsharp/symbols/SymbolHelpers.fs | 95 +++-- src/fsharp/symbols/SymbolPatterns.fs | 2 +- src/fsharp/symbols/Symbols.fs | 144 +++---- src/fsharp/symbols/Symbols.fsi | 12 +- src/fsharp/tast.fs | 48 +-- src/fsharp/xlf/FSComp.txt.cs.xlf | 5 + src/fsharp/xlf/FSComp.txt.de.xlf | 5 + src/fsharp/xlf/FSComp.txt.en.xlf | 5 + src/fsharp/xlf/FSComp.txt.es.xlf | 5 + src/fsharp/xlf/FSComp.txt.fr.xlf | 5 + src/fsharp/xlf/FSComp.txt.it.xlf | 5 + src/fsharp/xlf/FSComp.txt.ja.xlf | 5 + src/fsharp/xlf/FSComp.txt.ko.xlf | 5 + src/fsharp/xlf/FSComp.txt.pl.xlf | 5 + src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 + src/fsharp/xlf/FSComp.txt.ru.xlf | 5 + src/fsharp/xlf/FSComp.txt.tr.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 5 + src/ilx/EraseUnions.fs | 2 +- tests/fsharp/core/csext/test.fsx | 260 ++++++++++++ tests/fsharp/core/forwarders/a.cs | 2 +- tests/fsharp/core/members/absil.fsi | 2 +- tests/fsharp/core/members/ops-mutrec/test.fs | 2 +- tests/fsharp/core/members/ops/test.fsx | 2 +- tests/fsharp/typecheck/sigs/neg101.bsl | 74 +++- tests/fsharp/typecheck/sigs/neg101.fs | 41 ++ tests/fsharp/typecheck/sigs/pos28.fs | 2 + .../E_LeftToRightOverloadResolution01.fs | 2 +- .../TypeExtensions/basic/GenericExtensions.fs | 58 +-- .../basic/GenericExtensionsCSLib.cs | 16 +- tests/scripts/compiler-perf.fsx | 4 +- tests/service/CSharpProjectAnalysis.fs | 4 +- tests/service/EditorTests.fs | 4 +- tests/service/ExprTests.fs | 4 +- tests/service/MultiProjectAnalysisTests.fs | 4 +- tests/service/ProjectAnalysisTests.fs | 26 +- .../FSharpCheckerExtensions.fs | 6 +- .../unittests/CompletionProviderTests.fs | 2 +- .../Tests.LanguageService.ParameterInfo.fs | 3 +- .../unittests/VisualFSharp.UnitTests.fsproj | 32 +- 91 files changed, 1525 insertions(+), 822 deletions(-) diff --git a/.gitignore b/.gitignore index 236ddf853f..a78b05f7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,11 @@ /packages /Tools +/tests/scripts/current +/release +/debug +/Proto + # Patches that may have been generated by scripts. # (These aren't generally useful to commit directly; if anything, they should be applied.) scripts/*.patch diff --git a/fcs/README.md b/fcs/README.md index 51aa24fbbe..ffe9546e80 100644 --- a/fcs/README.md +++ b/fcs/README.md @@ -60,9 +60,9 @@ which does things like: Yu can push the packages if you have permissions, either automatically using ``build Release`` or manually set APIKEY=... - .nuget\nuget.exe push Release\FSharp.Compiler.Service.16.0.3.nupkg %APIKEY% -Source https://nuget.org - .nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.16.0.3.nupkg %APIKEY% -Source https://nuget.org - .nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.16.0.3.nupkg %APIKEY% -Source https://nuget.org + .nuget\nuget.exe push Release\FSharp.Compiler.Service.19.0.1.nupkg %APIKEY% -Source https://nuget.org + .nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.19.0.1.nupkg %APIKEY% -Source https://nuget.org + .nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.19.0.1.nupkg %APIKEY% -Source https://nuget.org ### Use of Paket and FAKE diff --git a/fcs/RELEASE_NOTES.md b/fcs/RELEASE_NOTES.md index 44eeb9ef34..8a98636494 100644 --- a/fcs/RELEASE_NOTES.md +++ b/fcs/RELEASE_NOTES.md @@ -1,3 +1,13 @@ +#### 19.0.1 + * Rename ``LogicalEnclosingEntity`` to ``ApparentEnclosingEntity`` for consistency int he F# codebase terminology. + * Rename ``EnclosingEntity`` to ``DeclaringEntity``. In the case of extension properties, ``EnclosingEntity`` was incorrectly returning the logical enclosing entity (i.e. the type the property appears to extend), and in this case ``ApparentEnclosingEntity`` should be used instead. + +#### 18.0.1 + * Integrate visualfsharp master + +#### 17.0.2 + * Integrate visualfsharp master + #### 16.0.3 * [File name deduplication not working with ParseAndCheckFileInProject](https://github.com/fsharp/FSharp.Compiler.Service/issues/819) @@ -404,7 +414,7 @@ * Return additional 'property' and 'event' methods for F#-defined types to regularize symbols (#108, #143) * Add IsPropertySetterMethod and IsPropertyGetterMethod which only return true for getter/setter methods, not properties. Deprecate IsSetterMethod and IsGetterMethod in favour of these. * Add IsEventAddMethod and IsEventRemoveMethod which return true for add/remove methods with an associated event -* Change IsProperty and IsEvent to only return true for the symbols for properties and events, rather than the methods assocaited with these +* Change IsProperty and IsEvent to only return true for the symbols for properties and events, rather than the methods associated with these * Fix value of Assembly for some symbols (e.g. property symbols) #### 0.0.45 - diff --git a/fcs/docsrc/content/ja/symbols.fsx b/fcs/docsrc/content/ja/symbols.fsx index 15ebfab65b..c962a2b8f6 100644 --- a/fcs/docsrc/content/ja/symbols.fsx +++ b/fcs/docsrc/content/ja/symbols.fsx @@ -113,8 +113,8 @@ fnVal.CurriedParameterGroups.[0].[0].Name // "x" fnVal.CurriedParameterGroups.[0].[1].Name // "y" fnVal.DeclarationLocation.StartLine // 3 fnVal.DisplayName // "foo" -fnVal.EnclosingEntity.DisplayName // "Test" -fnVal.EnclosingEntity.DeclarationLocation.StartLine // 1 +fnVal.DeclaringEntity.DisplayName // "Test" +fnVal.DeclaringEntity.DeclarationLocation.StartLine // 1 fnVal.GenericParameters.Count // 0 fnVal.InlineAnnotation // FSharpInlineAnnotation.OptionalInline fnVal.IsActivePattern // false diff --git a/fcs/docsrc/content/symbols.fsx b/fcs/docsrc/content/symbols.fsx index a4e118df1b..fb6275fd37 100644 --- a/fcs/docsrc/content/symbols.fsx +++ b/fcs/docsrc/content/symbols.fsx @@ -109,8 +109,8 @@ fnVal.CurriedParameterGroups.[0].[0].Name // "x" fnVal.CurriedParameterGroups.[0].[1].Name // "y" fnVal.DeclarationLocation.StartLine // 3 fnVal.DisplayName // "foo" -fnVal.EnclosingEntity.DisplayName // "Test" -fnVal.EnclosingEntity.DeclarationLocation.StartLine // 1 +fnVal.DeclaringEntity.DisplayName // "Test" +fnVal.DeclaringEntity.DeclarationLocation.StartLine // 1 fnVal.GenericParameters.Count // 0 fnVal.InlineAnnotation // FSharpInlineAnnotation.OptionalInline fnVal.IsActivePattern // false diff --git a/fcs/fcs.props b/fcs/fcs.props index 88fb2f42ac..3c813b2b34 100644 --- a/fcs/fcs.props +++ b/fcs/fcs.props @@ -3,7 +3,7 @@ - 16.0.3 + 19.0.1 $(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools diff --git a/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec b/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec index ae9c17a781..6c20765492 100644 --- a/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec +++ b/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec @@ -5,7 +5,7 @@ Adds legacy MSBuild 12.0 support to the F# compiler services package for resolving references such as #r "System, Version=4.1.0.0,..." en-US false - 16.0.3 + 19.0.1 Microsoft Corporation and F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service @@ -14,7 +14,7 @@ F# compiler services for creating IDE tools, language extensions and for F# embedding. - + diff --git a/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec b/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec index e45bb83572..9b2f6ea823 100644 --- a/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec +++ b/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec @@ -5,7 +5,7 @@ The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications. en-US false - 16.0.3 + 19.0.1 Microsoft Corporation and F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service @@ -14,7 +14,7 @@ F# compiler services for creating IDE tools, language extensions and for F# embedding. - + diff --git a/fcs/nuget/FSharp.Compiler.Service.nuspec b/fcs/nuget/FSharp.Compiler.Service.nuspec index ba4c2e7c3d..37229cf4a3 100644 --- a/fcs/nuget/FSharp.Compiler.Service.nuspec +++ b/fcs/nuget/FSharp.Compiler.Service.nuspec @@ -5,7 +5,7 @@ The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications. en-US false - 16.0.3 + 19.0.1 Microsoft Corporation and F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service diff --git a/src/absil/il.fs b/src/absil/il.fs index 6f5f0d873b..9335440f70 100644 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -726,7 +726,7 @@ type ILMethodRef = mrefName: string; mrefArgs: ILTypes; mrefReturn: ILType } - member x.EnclosingTypeRef = x.mrefParent + member x.DeclaringTypeRef = x.mrefParent member x.CallingConv = x.mrefCallconv member x.Name = x.mrefName member x.GenericArity = x.mrefGenericArity @@ -737,24 +737,24 @@ type ILMethodRef = member x.CallingSignature = mkILCallSig (x.CallingConv,x.ArgTypes,x.ReturnType) static member Create(a,b,c,d,e,f) = { mrefParent= a;mrefCallconv=b;mrefName=c;mrefGenericArity=d; mrefArgs=e;mrefReturn=f } - override x.ToString() = x.EnclosingTypeRef.ToString() + "::" + x.Name + "(...)" + override x.ToString() = x.DeclaringTypeRef.ToString() + "::" + x.Name + "(...)" [] type ILFieldRef = - { EnclosingTypeRef: ILTypeRef; + { DeclaringTypeRef: ILTypeRef; Name: string; Type: ILType } - override x.ToString() = x.EnclosingTypeRef.ToString() + "::" + x.Name + override x.ToString() = x.DeclaringTypeRef.ToString() + "::" + x.Name [] type ILMethodSpec = { mspecMethodRef: ILMethodRef; - mspecEnclosingType: ILType; + mspecDeclaringType: ILType; mspecMethodInst: ILGenericArgs; } - static member Create(a,b,c) = { mspecEnclosingType=a; mspecMethodRef =b; mspecMethodInst=c } + static member Create(a,b,c) = { mspecDeclaringType=a; mspecMethodRef =b; mspecMethodInst=c } member x.MethodRef = x.mspecMethodRef - member x.EnclosingType=x.mspecEnclosingType + member x.DeclaringType=x.mspecDeclaringType member x.GenericArgs=x.mspecMethodInst member x.Name=x.MethodRef.Name member x.CallingConv=x.MethodRef.CallingConv @@ -766,10 +766,10 @@ type ILMethodSpec = type ILFieldSpec = { FieldRef: ILFieldRef; - EnclosingType: ILType } + DeclaringType: ILType } member x.FormalType = x.FieldRef.Type member x.Name = x.FieldRef.Name - member x.EnclosingTypeRef = x.FieldRef.EnclosingTypeRef + member x.DeclaringTypeRef = x.FieldRef.DeclaringTypeRef override x.ToString() = x.FieldRef.ToString() @@ -1302,7 +1302,7 @@ type ILReturn = type ILOverridesSpec = | OverridesSpec of ILMethodRef * ILType member x.MethodRef = let (OverridesSpec(mr,_ty)) = x in mr - member x.EnclosingType = let (OverridesSpec(_mr,ty)) = x in ty + member x.DeclaringType = let (OverridesSpec(_mr,ty)) = x in ty type ILMethodVirtualInfo = { IsFinal: bool @@ -1817,10 +1817,10 @@ let mkILMethRef (tref,callconv,nm,gparams,args,rty) = let mkILMethSpecForMethRefInTy (mref,typ,minst) = { mspecMethodRef=mref; - mspecEnclosingType=typ; + mspecDeclaringType=typ; mspecMethodInst=minst } -let mkILMethSpec (mref, vc, tinst, minst) = mkILMethSpecForMethRefInTy (mref,mkILNamedTy vc mref.EnclosingTypeRef tinst, minst) +let mkILMethSpec (mref, vc, tinst, minst) = mkILMethSpecForMethRefInTy (mref,mkILNamedTy vc mref.DeclaringTypeRef tinst, minst) let mk_mspec_in_tref (tref,vc,cc,nm,args,rty,tinst,minst) = mkILMethSpec (mkILMethRef ( tref,cc,nm,List.length minst,args,rty),vc,tinst,minst) @@ -1856,9 +1856,9 @@ let mkILNonGenericCtorMethSpec (tref,args) = // Make references to fields // -------------------------------------------------------------------- -let mkILFieldRef(tref,nm,ty) = { EnclosingTypeRef=tref; Name=nm; Type=ty} +let mkILFieldRef(tref,nm,ty) = { DeclaringTypeRef=tref; Name=nm; Type=ty} -let mkILFieldSpec (tref,ty) = { FieldRef= tref; EnclosingType=ty } +let mkILFieldSpec (tref,ty) = { FieldRef= tref; DeclaringType=ty } let mkILFieldSpecInTy (typ:ILType,nm,fty) = mkILFieldSpec (mkILFieldRef (typ.TypeRef,nm,fty), typ) @@ -2205,7 +2205,7 @@ and rescopeILCallSig scoref csig = mkILCallSig (csig.CallingConv,rescopeILTypes scoref csig.ArgTypes,rescopeILType scoref csig.ReturnType) let rescopeILMethodRef scoref (x:ILMethodRef) = - { mrefParent = rescopeILTypeRef scoref x.EnclosingTypeRef; + { mrefParent = rescopeILTypeRef scoref x.DeclaringTypeRef; mrefCallconv = x.mrefCallconv; mrefGenericArity=x.mrefGenericArity; mrefName=x.mrefName; @@ -2213,7 +2213,7 @@ let rescopeILMethodRef scoref (x:ILMethodRef) = mrefReturn= rescopeILType scoref x.mrefReturn } let rescopeILFieldRef scoref x = - { EnclosingTypeRef = rescopeILTypeRef scoref x.EnclosingTypeRef; + { DeclaringTypeRef = rescopeILTypeRef scoref x.DeclaringTypeRef; Name= x.Name; Type= rescopeILType scoref x.Type } @@ -2277,7 +2277,7 @@ let mkILLocal ty dbgInfo : ILLocal = type ILFieldSpec with member fr.ActualType = - let env = fr.EnclosingType.GenericArgs + let env = fr.DeclaringType.GenericArgs instILType env fr.FormalType // -------------------------------------------------------------------- @@ -3482,20 +3482,20 @@ and refs_of_genparams s b = List.iter (refs_of_genparam s) b and refs_of_dloc s ts = refs_of_tref s ts and refs_of_mref s (x:ILMethodRef) = - refs_of_dloc s x.EnclosingTypeRef ; + refs_of_dloc s x.DeclaringTypeRef ; refs_of_typs s x.mrefArgs; refs_of_typ s x.mrefReturn -and refs_of_fref s x = refs_of_tref s x.EnclosingTypeRef; refs_of_typ s x.Type +and refs_of_fref s x = refs_of_tref s x.DeclaringTypeRef; refs_of_typ s x.Type and refs_of_ospec s (OverridesSpec(mref,ty)) = refs_of_mref s mref; refs_of_typ s ty and refs_of_mspec s (x: ILMethodSpec) = refs_of_mref s x.MethodRef; - refs_of_typ s x.EnclosingType; + refs_of_typ s x.DeclaringType; refs_of_inst s x.GenericArgs and refs_of_fspec s x = refs_of_fref s x.FieldRef; - refs_of_typ s x.EnclosingType + refs_of_typ s x.DeclaringType and refs_of_typs s l = List.iter (refs_of_typ s) l @@ -3769,11 +3769,11 @@ let ungenericizeTypeName n = type ILEventRef = { erA: ILTypeRef; erB: string } static member Create(a,b) = {erA=a;erB=b} - member x.EnclosingTypeRef = x.erA + member x.DeclaringTypeRef = x.erA member x.Name = x.erB type ILPropertyRef = { prA: ILTypeRef; prB: string } static member Create (a,b) = {prA=a;prB=b} - member x.EnclosingTypeRef = x.prA + member x.DeclaringTypeRef = x.prA member x.Name = x.prB diff --git a/src/absil/il.fsi b/src/absil/il.fsi index 4d3cfd74d4..b6f374217f 100644 --- a/src/absil/il.fsi +++ b/src/absil/il.fsi @@ -372,7 +372,7 @@ and ILTypes = list [] type ILMethodRef = static member Create : enclosingTypeRef: ILTypeRef * callingConv: ILCallingConv * name: string * genericArity: int * argTypes: ILTypes * returnType: ILType -> ILMethodRef - member EnclosingTypeRef: ILTypeRef + member DeclaringTypeRef: ILTypeRef member CallingConv: ILCallingConv member Name: string member GenericArity: int @@ -386,7 +386,7 @@ type ILMethodRef = [] type ILFieldRef = - { EnclosingTypeRef: ILTypeRef; + { DeclaringTypeRef: ILTypeRef; Name: string; Type: ILType } @@ -407,7 +407,7 @@ type ILFieldRef = type ILMethodSpec = static member Create : ILType * ILMethodRef * ILGenericArgs -> ILMethodSpec member MethodRef: ILMethodRef - member EnclosingType: ILType + member DeclaringType: ILType member GenericArgs: ILGenericArgs member CallingConv: ILCallingConv member GenericArity: int @@ -421,8 +421,8 @@ type ILMethodSpec = [] type ILFieldSpec = { FieldRef: ILFieldRef; - EnclosingType: ILType } - member EnclosingTypeRef: ILTypeRef + DeclaringType: ILType } + member DeclaringTypeRef: ILTypeRef member Name: string member FormalType: ILType member ActualType : ILType @@ -963,7 +963,7 @@ type PInvokeMethod = type ILOverridesSpec = | OverridesSpec of ILMethodRef * ILType member MethodRef: ILMethodRef - member EnclosingType: ILType + member DeclaringType: ILType // REVIEW: fold this into ILMethodDef. type ILMethodVirtualInfo = @@ -1921,13 +1921,13 @@ val computeILEnumInfo: string * ILFieldDefs -> ILEnumInfo [] type ILEventRef = static member Create : ILTypeRef * string -> ILEventRef - member EnclosingTypeRef: ILTypeRef + member DeclaringTypeRef: ILTypeRef member Name: string [] type ILPropertyRef = static member Create : ILTypeRef * string -> ILPropertyRef - member EnclosingTypeRef: ILTypeRef + member DeclaringTypeRef: ILTypeRef member Name: string interface System.IComparable diff --git a/src/absil/ilmorph.fs b/src/absil/ilmorph.fs index dc0d27e1fe..90b0e267f6 100644 --- a/src/absil/ilmorph.fs +++ b/src/absil/ilmorph.fs @@ -103,7 +103,7 @@ let gparam_typ2typ f gf = {gf with Constraints = List.map f gf.Constraints} let gparams_typ2typ f gfs = List.map (gparam_typ2typ f) gfs let typs_typ2typ (f: ILType -> ILType) x = List.map f x let mref_typ2typ (f: ILType -> ILType) (x:ILMethodRef) = - ILMethodRef.Create(enclosingTypeRef= (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef, + ILMethodRef.Create(enclosingTypeRef= (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef, callingConv=x.CallingConv, name=x.Name, genericArity=x.GenericArity, @@ -115,16 +115,16 @@ type formal_scopeCtxt = Choice let mspec_typ2typ (((factualty : ILType -> ILType) , (fformalty: formal_scopeCtxt -> ILType -> ILType))) (x: ILMethodSpec) = mkILMethSpecForMethRefInTy(mref_typ2typ (fformalty (Choice1Of2 x)) x.MethodRef, - factualty x.EnclosingType, + factualty x.DeclaringType, typs_typ2typ factualty x.GenericArgs) let fref_typ2typ (f: ILType -> ILType) x = - { x with EnclosingTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef; + { x with DeclaringTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef; Type= f x.Type } let fspec_typ2typ ((factualty,(fformalty : formal_scopeCtxt -> ILType -> ILType))) x = { FieldRef=fref_typ2typ (fformalty (Choice2Of2 x)) x.FieldRef; - EnclosingType= factualty x.EnclosingType } + DeclaringType= factualty x.DeclaringType } let rec celem_typ2typ f celem = match celem with diff --git a/src/absil/ilprint.fs b/src/absil/ilprint.fs index 6c98fc605b..0e1727effe 100644 --- a/src/absil/ilprint.fs +++ b/src/absil/ilprint.fs @@ -338,12 +338,12 @@ and goutput_mref env os (mref:ILMethodRef) = and goutput_mspec env os (mspec:ILMethodSpec) = let fenv = ppenv_enter_method mspec.GenericArity - (ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env) + (ppenv_enter_tdef (mkILFormalTypars mspec.DeclaringType.GenericArgs) env) output_callconv os mspec.CallingConv; output_string os " "; goutput_typ fenv os mspec.FormalReturnType; output_string os " "; - goutput_dlocref env os mspec.EnclosingType; + goutput_dlocref env os mspec.DeclaringType; output_string os " "; let name = mspec.Name if name = ".ctor" || name = ".cctor" then output_string os name else output_id os name; @@ -356,12 +356,12 @@ and goutput_vararg_mspec env os (mspec, varargs) = | Some varargs' -> let fenv = ppenv_enter_method mspec.GenericArity - (ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env) + (ppenv_enter_tdef (mkILFormalTypars mspec.DeclaringType.GenericArgs) env) output_callconv os mspec.CallingConv; output_string os " "; goutput_typ fenv os mspec.FormalReturnType; output_string os " "; - goutput_dlocref env os mspec.EnclosingType; + goutput_dlocref env os mspec.DeclaringType; let name = mspec.Name if name = ".ctor" || name = ".cctor" then output_string os name else output_id os name goutput_gactuals env os mspec.GenericArgs; @@ -385,10 +385,10 @@ and goutput_vararg_sig env os (csig:ILCallingSignature,varargs:ILVarArgs) = output_string os ")"; and goutput_fspec env os (x:ILFieldSpec) = - let fenv = ppenv_enter_tdef (mkILFormalTypars x.EnclosingType.GenericArgs) env + let fenv = ppenv_enter_tdef (mkILFormalTypars x.DeclaringType.GenericArgs) env goutput_typ fenv os x.FormalType; output_string os " "; - goutput_dlocref env os x.EnclosingType; + goutput_dlocref env os x.DeclaringType; output_id os x.Name let output_member_access os access = diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index f4ea49effe..b4a88f58e7 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -1877,7 +1877,7 @@ and seekReadMethodRefParent ctxt numtypars (TaggedIndex(tag, idx)) = | tag when tag = mrp_MethodDef -> let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData ctxt idx let mspec = mkILMethSpecInTy (enclTyp, cc, nm, argtys, retty, minst) - mspec.EnclosingType + mspec.DeclaringType | tag when tag = mrp_TypeSpec -> readBlobHeapAsType ctxt numtypars (seekReadTypeSpecRow ctxt idx) | _ -> failwith "seekReadMethodRefParent ctxt" @@ -2416,7 +2416,7 @@ and seekReadMethodImpls ctxt numtypars tidx = Overrides= let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefOrRefNoVarargs ctxt numtypars c let mspec = mkILMethSpecInTy (enclTyp, cc, nm, argtys, retty, minst) - OverridesSpec(mspec.MethodRef, mspec.EnclosingType) })) + OverridesSpec(mspec.MethodRef, mspec.DeclaringType) })) and seekReadMultipleMethodSemantics ctxt (flags, id) = seekReadIndexedRows diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs index f35e6e7b79..774b7a2436 100644 --- a/src/absil/ilreflect.fs +++ b/src/absil/ilreflect.fs @@ -654,7 +654,7 @@ let typeIsNotQueryable (typ : Type) = let queryableTypeGetField _emEnv (parentT:Type) (fref: ILFieldRef) = let res = parentT.GetField(fref.Name, BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance ||| BindingFlags.Static ) match res with - | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fref.Name, fref.EnclosingTypeRef.FullName, fref.EnclosingTypeRef.Scope.QualifiedName), range0)) + | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fref.Name, fref.DeclaringTypeRef.FullName, fref.DeclaringTypeRef.Scope.QualifiedName), range0)) | _ -> res let nonQueryableTypeGetField (parentTI:Type) (fieldInfo : FieldInfo) : FieldInfo = @@ -668,8 +668,8 @@ let nonQueryableTypeGetField (parentTI:Type) (fieldInfo : FieldInfo) : FieldInfo let convFieldSpec cenv emEnv fspec = let fref = fspec.FieldRef - let tref = fref.EnclosingTypeRef - let parentTI = convType cenv emEnv fspec.EnclosingType + let tref = fref.DeclaringTypeRef + let parentTI = convType cenv emEnv fspec.DeclaringType if isEmittedTypeRef emEnv tref then // NOTE: if "convType becomes convCreatedType", then handle queryable types here too. [bug 4063] (necessary? what repro?) let fieldB = envGetFieldB emEnv fref @@ -793,7 +793,7 @@ let nonQueryableTypeGetMethod (parentTI:Type) (methInfo : MethodInfo) : MethodIn else methInfo let convMethodRef cenv emEnv (parentTI:Type) (mref:ILMethodRef) = - let parent = mref.EnclosingTypeRef + let parent = mref.DeclaringTypeRef let res = if isEmittedTypeRef emEnv parent then // NOTE: if "convType becomes convCreatedType", then handle queryable types here too. [bug 4063] @@ -817,7 +817,7 @@ let convMethodRef cenv emEnv (parentTI:Type) (mref:ILMethodRef) = //---------------------------------------------------------------------------- let convMethodSpec cenv emEnv (mspec:ILMethodSpec) = - let typT = convType cenv emEnv mspec.EnclosingType (* (instanced) parent Type *) + let typT = convType cenv emEnv mspec.DeclaringType (* (instanced) parent Type *) let methInfo = convMethodRef cenv emEnv typT mspec.MethodRef (* (generic) method of (generic) parent *) let methInfo = if isNil mspec.GenericArgs then @@ -852,9 +852,9 @@ let nonQueryableTypeGetConstructor (parentTI:Type) (consInfo : ConstructorInfo) let convConstructorSpec cenv emEnv (mspec:ILMethodSpec) = let mref = mspec.MethodRef - let parentTI = convType cenv emEnv mspec.EnclosingType + let parentTI = convType cenv emEnv mspec.DeclaringType let res = - if isEmittedTypeRef emEnv mref.EnclosingTypeRef then + if isEmittedTypeRef emEnv mref.DeclaringTypeRef then let consB = envGetConsB emEnv mref nonQueryableTypeGetConstructor parentTI consB else diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 81fcf5be8a..8ea9dec6a7 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -406,8 +406,8 @@ type ILTypeWriterEnv = { EnclosingTyparCount: int } let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue } -let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length } -let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.EnclosingType.GenericArgs.Length } +let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.DeclaringType.GenericArgs.Length } +let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.DeclaringType.GenericArgs.Length } //--------------------------------------------------------------------- // TABLES @@ -1285,7 +1285,7 @@ and GetFieldDefAsFieldDefIdx cenv tidx fd = // -------------------------------------------------------------------- let GetMethodRefAsMethodDefIdx cenv (mref:ILMethodRef) = - let tref = mref.EnclosingTypeRef + let tref = mref.DeclaringTypeRef try if not (isTypeRefLocal tref) then failwithf "method referred to by method impl, event or property is not in a type defined in this module, method ref is %A" mref @@ -1358,7 +1358,7 @@ and GetMethodSpecAsMethodDef cenv env (mspec, varargs) = and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = (mspec.Name, - mspec.EnclosingType, + mspec.DeclaringType, mspec.CallingConv, mspec.FormalArgTypes, mspec.FormalReturnType, @@ -1373,11 +1373,11 @@ and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) = let rec GetOverridesSpecAsMemberRefIdx cenv env ospec = let fenv = envForOverrideSpec ospec - let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.EnclosingType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity) + let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.DeclaringType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity) FindOrAddSharedRow cenv TableNames.MemberRef row and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) = - let typ = ospec.EnclosingType + let typ = ospec.DeclaringType if isTypeLocal typ then if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ" try (mdor_MethodDef, GetMethodRefAsMethodDefIdx cenv ospec.MethodRef) @@ -1392,12 +1392,12 @@ and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) = // -------------------------------------------------------------------- let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) = - let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, mkILNonGenericBoxedTy mref.EnclosingTypeRef, mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) + let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, mkILNonGenericBoxedTy mref.DeclaringTypeRef, mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity) FindOrAddSharedRow cenv TableNames.MemberRef row and GetMethodRefAsCustomAttribType cenv (mref:ILMethodRef) = let fenv = envForNonGenericMethodRef mref - let tref = mref.EnclosingTypeRef + let tref = mref.DeclaringTypeRef if isTypeRefLocal tref then try (cat_MethodDef, GetMethodRefAsMethodDefIdx cenv mref) with MethodDefNotFound -> (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref) @@ -1452,7 +1452,7 @@ and GenSecurityDeclsPass3 cenv hds attrs = // -------------------------------------------------------------------- let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) = - MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType, + MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.DeclaringType, GetStringHeapIdx cenv fspec.Name, GetFieldSpecSigAsBlobIdx cenv fenv fspec) @@ -1472,7 +1472,7 @@ and GetFieldSpecSigAsBlobIdx cenv env x = GetBytesAsBlobIdx cenv (GetFieldSpecSigAsBytes cenv env x) and GetFieldSpecAsFieldDefOrRef cenv env (fspec:ILFieldSpec) = - let typ = fspec.EnclosingType + let typ = fspec.DeclaringType if isTypeLocal typ then if not typ.IsNominal then failwith "GetFieldSpecAsFieldDefOrRef: unexpected local tref-typ" let tref = typ.TypeRef diff --git a/src/absil/ilx.fs b/src/absil/ilx.fs index afe285ae73..d28ff3d2f4 100644 --- a/src/absil/ilx.fs +++ b/src/absil/ilx.fs @@ -49,7 +49,7 @@ type IlxUnionRef = type IlxUnionSpec = | IlxUnionSpec of IlxUnionRef * ILGenericArgs - member x.EnclosingType = let (IlxUnionSpec(IlxUnionRef(bx, tref, _, _, _), inst)) = x in mkILNamedTy bx tref inst + member x.DeclaringType = let (IlxUnionSpec(IlxUnionRef(bx, tref, _, _, _), inst)) = x in mkILNamedTy bx tref inst member x.Boxity = let (IlxUnionSpec(IlxUnionRef(bx, _, _, _, _), _)) = x in bx member x.TypeRef = let (IlxUnionSpec(IlxUnionRef(_, tref, _, _, _), _)) = x in tref member x.GenericArgs = let (IlxUnionSpec(_, inst)) = x in inst diff --git a/src/absil/ilx.fsi b/src/absil/ilx.fsi index 6ee5eceef1..39792635fe 100644 --- a/src/absil/ilx.fsi +++ b/src/absil/ilx.fsi @@ -44,7 +44,7 @@ type IlxUnionRef = type IlxUnionSpec = | IlxUnionSpec of IlxUnionRef * ILGenericArgs - member EnclosingType : ILType + member DeclaringType : ILType member GenericArgs : ILGenericArgs member Alternatives : IlxUnionAlternative list member AlternativesArray : IlxUnionAlternative[] diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs index abc321272d..63c331ab68 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs @@ -4300,6 +4300,9 @@ type internal SR private() = /// An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. /// (Originally from ..\FSComp.txt:1424) static member pickleUnexpectedNonZero(a0 : System.String) = (3219, GetStringFunc("pickleUnexpectedNonZero",",,,%s,,,") a0) + /// This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + /// (Originally from ..\FSComp.txt:1425) + static member tcTupleMemberNotNormallyUsed() = (3220, GetStringFunc("tcTupleMemberNotNormallyUsed",",,,") ) /// Call this method once to validate that all known resources are valid; throws if not static member RunStartupValidation() = @@ -5698,4 +5701,5 @@ type internal SR private() = ignore(GetString("notAFunctionButMaybeDeclaration")) ignore(GetString("ArgumentsInSigAndImplMismatch")) ignore(GetString("pickleUnexpectedNonZero")) + ignore(GetString("tcTupleMemberNotNormallyUsed")) () diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx index 71f965fc9f..6ea0731264 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx @@ -4303,4 +4303,7 @@ An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + \ No newline at end of file diff --git a/src/fsharp/AccessibilityLogic.fs b/src/fsharp/AccessibilityLogic.fs index af5842de44..9bd6efd5b1 100644 --- a/src/fsharp/AccessibilityLogic.fs +++ b/src/fsharp/AccessibilityLogic.fs @@ -162,8 +162,8 @@ let private IsILTypeInfoAccessible amap m ad (tcrefOfViewedItem : TyconRef) = check None (enc @ [tdef]) /// Indicates if an IL member associated with the given ILType is accessible -let private IsILTypeAndMemberAccessible g amap m adType ad (ILTypeInfo(tcrefOfViewedItem, _, _, _)) access = - IsILTypeInfoAccessible amap m adType tcrefOfViewedItem && IsILMemberAccessible g amap m tcrefOfViewedItem ad access +let private IsILTypeAndMemberAccessible g amap m adType ad (typ: ILTypeInfo) access = + IsILTypeInfoAccessible amap m adType typ.TyconRefOfRawMetadata && IsILMemberAccessible g amap m typ.TyconRefOfRawMetadata ad access /// Indicates if an entity is accessible let IsEntityAccessible amap m ad (tcref:TyconRef) = @@ -226,9 +226,9 @@ let IsILFieldInfoAccessible g amap m ad x = match x with | ILFieldInfo (tinfo,fd) -> IsILTypeAndMemberAccessible g amap m ad ad tinfo fd.Access #if !NO_EXTENSIONTYPING - | ProvidedField (amap, tpfi, m) as pfi -> + | ProvidedField (amap, tpfi, m) -> let access = tpfi.PUntaint((fun fi -> ComputeILAccess fi.IsPublic fi.IsFamily fi.IsFamilyOrAssembly fi.IsFamilyAndAssembly), m) - IsProvidedMemberAccessible amap m ad pfi.EnclosingType access + IsProvidedMemberAccessible amap m ad x.ApparentEnclosingType access #endif let GetILAccessOfILEventInfo (ILEventInfo (tinfo,edef)) = @@ -314,12 +314,12 @@ let IsTypeAndMethInfoAccessible amap m adTyp ad = function #if !NO_EXTENSIONTYPING | ProvidedMeth(amap,tpmb,_,m) as etmi -> let access = tpmb.PUntaint((fun mi -> ComputeILAccess mi.IsPublic mi.IsFamily mi.IsFamilyOrAssembly mi.IsFamilyAndAssembly), m) - IsProvidedMemberAccessible amap m ad etmi.EnclosingType access + IsProvidedMemberAccessible amap m ad etmi.ApparentEnclosingType access #endif let IsMethInfoAccessible amap m ad minfo = IsTypeAndMethInfoAccessible amap m ad ad minfo let IsPropInfoAccessible g amap m ad = function - | ILProp (_,x) -> IsILPropInfoAccessible g amap m ad x + | ILProp ilpinfo -> IsILPropInfoAccessible g amap m ad ilpinfo | FSProp (_,_,Some vref,_) | FSProp (_,_,_,Some vref) -> IsValAccessible ad vref #if !NO_EXTENSIONTYPING @@ -334,7 +334,7 @@ let IsPropInfoAccessible g amap m ad = function | None -> tryGetILAccessForProvidedMethodBase(ppi.GetSetMethod()) | x -> x), m) defaultArg a ILMemberAccess.Public - IsProvidedMemberAccessible amap m ad pp.EnclosingType access + IsProvidedMemberAccessible amap m ad pp.ApparentEnclosingType access #endif | _ -> false diff --git a/src/fsharp/AttributeChecking.fs b/src/fsharp/AttributeChecking.fs index 9a63092da4..50f0bb1518 100644 --- a/src/fsharp/AttributeChecking.fs +++ b/src/fsharp/AttributeChecking.fs @@ -81,7 +81,7 @@ type AttribInfo = match x with | FSAttribInfo(_g,Attrib(tcref,_,_,_,_,_,_)) -> tcref | ILAttribInfo (g, amap, scoref, a, m) -> - let ty = ImportILType scoref amap m [] a.Method.EnclosingType + let ty = ImportILType scoref amap m [] a.Method.DeclaringType tcrefOfAppTy g ty member x.ConstructorArguments = @@ -154,7 +154,7 @@ let GetAttribInfosOfMethod amap m minfo = let GetAttribInfosOfProp amap m pinfo = match pinfo with - | ILProp(g,ilpinfo) -> ilpinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL g amap ilpinfo.ILTypeInfo.ILScopeRef m + | ILProp ilpinfo -> ilpinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL ilpinfo.TcGlobals amap ilpinfo.ILTypeInfo.ILScopeRef m | FSProp(g,_,Some vref,_) | FSProp(g,_,_,Some vref) -> vref.Attribs |> AttribInfosOfFS g | FSProp _ -> failwith "GetAttribInfosOfProp: unreachable" @@ -165,7 +165,7 @@ let GetAttribInfosOfProp amap m pinfo = let GetAttribInfosOfEvent amap m einfo = match einfo with - | ILEvent(g, x) -> x.RawMetadata.CustomAttrs |> AttribInfosOfIL g amap x.ILTypeInfo.ILScopeRef m + | ILEvent ileinfo -> ileinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL einfo.TcGlobals amap ileinfo.ILTypeInfo.ILScopeRef m | FSEvent(_, pi, _vref1, _vref2) -> GetAttribInfosOfProp amap m pi #if !NO_EXTENSIONTYPING // TODO: provided attributes @@ -373,7 +373,7 @@ let CheckProvidedAttributesForUnseen (provAttribs: Tainted CheckILAttributes g pdef.CustomAttrs m + | ILProp(ILPropInfo(_,pdef)) -> CheckILAttributes pinfo.TcGlobals pdef.CustomAttrs m | FSProp(g,_,Some vref,_) | FSProp(g,_,_,Some vref) -> CheckFSharpAttributes g vref.Attribs m | FSProp _ -> failwith "CheckPropInfoAttributes: unreachable" @@ -419,7 +419,7 @@ let CheckMethInfoAttributes g m tyargsOpt minfo = /// Indicate if a method has 'Obsolete', 'CompilerMessageAttribute' or 'TypeProviderEditorHideMethodsAttribute'. /// Used to suppress the item in intellisense. let MethInfoIsUnseen g m typ minfo = - let isUnseenByObsoleteAttrib = + let isUnseenByObsoleteAttrib () = match BindMethInfoAttributes m minfo (fun ilAttribs -> Some(CheckILAttributesForUnseen g ilAttribs m)) (fun fsAttribs -> Some(CheckFSharpAttributesForUnseen g fsAttribs m)) @@ -432,11 +432,11 @@ let MethInfoIsUnseen g m typ minfo = | Some res -> res | None -> false - let isUnseenByHidingAttribute = + let isUnseenByHidingAttribute () = #if !NO_EXTENSIONTYPING not (isObjTy g typ) && isAppTy g typ && - isObjTy g minfo.EnclosingType && + isObjTy g minfo.ApparentEnclosingType && let tcref = tcrefOfAppTy g typ match tcref.TypeReprInfo with | TProvidedTypeExtensionPoint info -> @@ -449,20 +449,26 @@ let MethInfoIsUnseen g m typ minfo = // just to look at the attributes on IL methods. if tcref.IsILTycon then tcref.ILTyconRawMetadata.CustomAttrs.AsList - |> List.exists (fun attr -> attr.Method.EnclosingType.TypeSpec.Name = typeof.FullName) + |> List.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = typeof.FullName) else false #else typ |> ignore false #endif - isUnseenByObsoleteAttrib || isUnseenByHidingAttribute + + //let isUnseenByBeingTupleMethod () = isAnyTupleTy g typ + + isUnseenByObsoleteAttrib () || isUnseenByHidingAttribute () //|| isUnseenByBeingTupleMethod () /// Indicate if a property has 'Obsolete' or 'CompilerMessageAttribute'. /// Used to suppress the item in intellisense. let PropInfoIsUnseen m pinfo = match pinfo with - | ILProp (g,ILPropInfo(_,pdef)) -> CheckILAttributesForUnseen g pdef.CustomAttrs m + | ILProp (ILPropInfo(_,pdef) as ilpinfo) -> + // Properties on .NET tuple types are resolvable but unseen + isAnyTupleTy pinfo.TcGlobals ilpinfo.ILTypeInfo.ToType || + CheckILAttributesForUnseen pinfo.TcGlobals pdef.CustomAttrs m | FSProp (g,_,Some vref,_) | FSProp (g,_,_,Some vref) -> CheckFSharpAttributesForUnseen g vref.Attribs m | FSProp _ -> failwith "CheckPropInfoAttributes: unreachable" diff --git a/src/fsharp/AugmentWithHashCompare.fs b/src/fsharp/AugmentWithHashCompare.fs index 901edf9d6f..7e914267bd 100644 --- a/src/fsharp/AugmentWithHashCompare.fs +++ b/src/fsharp/AugmentWithHashCompare.fs @@ -858,7 +858,7 @@ let slotImplMethod (final,c,slotsig) : ValMemberInfo = IsOverrideOrExplicitImpl=true MemberKind=MemberKind.Member} IsImplemented=false - ApparentParent=c} + ApparentEnclosingEntity=c} let nonVirtualMethod c : ValMemberInfo = { ImplementedSlotSigs=[] @@ -868,7 +868,7 @@ let nonVirtualMethod c : ValMemberInfo = IsOverrideOrExplicitImpl=false MemberKind=MemberKind.Member} IsImplemented=false - ApparentParent=c} + ApparentEnclosingEntity=c} let unitArg = ValReprInfo.unitArgData let unaryArg = [ ValReprInfo.unnamedTopArg ] diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 91dc8bb83b..d95a68a394 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -1249,7 +1249,7 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) = | _ :: ts -> hasUnitTType_app ts | [] -> false - match minfoVirt.EnclosingType with + match minfoVirt.ApparentEnclosingType with | TType_app (t, types) when t.IsFSharpInterfaceTycon && hasUnitTType_app types -> // match abstract member with 'unit' passed as generic argument os.Append(OverrideDoesntOverride4E().Format sig1) |> ignore @@ -1347,8 +1347,8 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) = | NonUniqueInferredAbstractSlot(_, denv, bindnm, bvirt1, bvirt2, _) -> os.Append(NonUniqueInferredAbstractSlot1E().Format bindnm) |> ignore - let ty1 = bvirt1.EnclosingType - let ty2 = bvirt2.EnclosingType + let ty1 = bvirt1.ApparentEnclosingType + let ty2 = bvirt2.ApparentEnclosingType // REVIEW: consider if we need to show _cxs (the type parameter constraints) let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 os.Append(NonUniqueInferredAbstractSlot2E().Format) |> ignore diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index d247366288..9758d9859b 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -1035,7 +1035,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep | _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argty1;argty2] when // Ignore any explicit +/- overloads from any basic integral types - (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.EnclosingType ) && + (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.ApparentEnclosingType ) && ( (IsNumericOrIntegralEnumType g argty1 || (nm = "op_Addition" && (isCharTy g argty1 || isStringTy g argty1))) && (permitWeakResolution || not (isTyparTy g argty2)) || (IsNumericOrIntegralEnumType g argty2 || (nm = "op_Addition" && (isCharTy g argty2 || isStringTy g argty2))) && (permitWeakResolution || not (isTyparTy g argty1)))) -> SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace argty2 argty1 ++ (fun () -> @@ -1044,7 +1044,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep | _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argty1;argty2] when // Ignore any explicit overloads from any basic integral types - (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.EnclosingType ) && + (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.ApparentEnclosingType ) && ( (IsRelationalType g argty1 && (permitWeakResolution || not (isTyparTy g argty2))) || (IsRelationalType g argty2 && (permitWeakResolution || not (isTyparTy g argty1))))) -> SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace argty2 argty1 ++ (fun () -> @@ -1286,9 +1286,9 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep let isInstance = minfo.IsInstance if isInstance <> memFlags.IsInstance then if isInstance then - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.EnclosingType), (DecompileOpName nm), nm), m, m2 )) + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (DecompileOpName nm), nm), m, m2 )) else - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.EnclosingType), (DecompileOpName nm), nm), m, m2 )) + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (DecompileOpName nm), nm), m, m2 )) else CheckMethInfoAttributes g m None minfo ++ (fun () -> ResultD (TTraitSolved (minfo, calledMeth.CalledTyArgs)))) @@ -1337,7 +1337,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst = match minfo with | ILMeth(_, ilMeth, _) -> let mref = IL.mkRefToILMethod (ilMeth.DeclaringTyconRef.CompiledRepresentationForNamedType, ilMeth.RawMetadata) - let iltref = ilMeth.DeclaringTyconRefOption |> Option.map (fun tcref -> tcref.CompiledRepresentationForNamedType) + let iltref = ilMeth.ILExtensionMethodDeclaringTyconRef |> Option.map (fun tcref -> tcref.CompiledRepresentationForNamedType) ILMethSln(ilMeth.ApparentEnclosingType, iltref, mref, minst) | FSMeth(_, typ, vref, _) -> FSMethSln(typ, vref, minst) @@ -1348,7 +1348,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst = let g = amap.g let minst = [] // GENERIC TYPE PROVIDERS: for generics, we would have an minst here let allArgVars, allArgs = minfo.GetParamTypes(amap, m, minst) |> List.concat |> List.mapi (fun i ty -> mkLocal m ("arg"+string i) ty) |> List.unzip - let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.EnclosingType] else []) |> List.unzip + let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.ApparentEnclosingType] else []) |> List.unzip let callMethInfoOpt, callExpr, callExprTy = ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m) let closedExprSln = ClosedExprSln (mkLambdas m [] (objArgVars@allArgVars) (callExpr, callExprTy) ) // If the call is a simple call to an IL method with all the arguments in the natural order, then revert to use ILMethSln. @@ -2040,7 +2040,7 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs, nNa | CallerNamedArg(id, _) :: _ -> if minfo.IsConstructor then let predictFields() = - minfo.DeclaringEntityRef.AllInstanceFieldsAsList + minfo.DeclaringTyconRef.AllInstanceFieldsAsList |> List.map (fun p -> p.Name.Replace("@", "")) |> System.Collections.Generic.HashSet @@ -2207,7 +2207,7 @@ and ResolveOverloading if isOpConversion then match calledMethGroup, reqdRetTyOpt with | h :: _, Some rty -> - Some (h.Method.EnclosingType, rty) + Some (h.Method.ApparentEnclosingType, rty) | _ -> None else None @@ -2598,15 +2598,16 @@ let CodegenWitnessThatTypSupportsTraitConstraint tcVal g amap m (traitInfo:Trait | None -> Choice4Of4() | Some sln -> match sln with - | ILMethSln(typ, extOpt, mref, minst) -> - let tcref, _tinst = destAppTy g typ + | ILMethSln(origTy, extOpt, mref, minst) -> + let metadataTy = helpEnsureTypeHasMetadata g origTy + let tcref, _tinst = destAppTy g metadataTy let mdef = IL.resolveILMethodRef tcref.ILTyconRawMetadata mref let ilMethInfo = match extOpt with - | None -> MethInfo.CreateILMeth(amap, m, typ, mdef) + | None -> MethInfo.CreateILMeth(amap, m, origTy, mdef) | Some ilActualTypeRef -> let actualTyconRef = Import.ImportILTypeRef amap m ilActualTypeRef - MethInfo.CreateILExtensionMeth(amap, m, typ, actualTyconRef, None, mdef) + MethInfo.CreateILExtensionMeth(amap, m, origTy, actualTyconRef, None, mdef) Choice1Of4 (ilMethInfo, minst) | FSMethSln(typ, vref, minst) -> Choice1Of4 (FSMeth(g, typ, vref, None), minst) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 5778f3dd92..2ca518ff53 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1421,3 +1421,4 @@ notAFunctionButMaybeIndexer,"This expression is not a function and cannot be app notAFunctionButMaybeDeclaration,"This value is not a function and cannot be applied. Did you forget to terminate a declaration?" 3218,ArgumentsInSigAndImplMismatch,"The argument names in the signature '%s' and implementation '%s' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling." 3219,pickleUnexpectedNonZero,"An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct." +3220,tcTupleMemberNotNormallyUsed,"This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead." diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 13e1f5bd67..4de82a8d7e 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -767,7 +767,7 @@ let GetMethodSpecForMemberVal amap g (memberInfo:ValMemberInfo) (vref:ValRef) = let flatArgInfos = List.concat curriedArgInfos let isCtor = (memberInfo.MemberFlags.MemberKind = MemberKind.Constructor) let cctor = (memberInfo.MemberFlags.MemberKind = MemberKind.ClassConstructor) - let parentTcref = vref.TopValActualParent + let parentTcref = vref.TopValDeclaringEntity let parentTypars = parentTcref.TyparsNoRange let numParentTypars = parentTypars.Length if tps.Length < numParentTypars then error(InternalError("CodeGen check: type checking did not ensure that this method is sufficiently generic", m)) @@ -1505,7 +1505,7 @@ let GenConstArray cenv (cgbuf:CodeGenBuffer) eenv ilElementType (data:'a[]) (wri let ilFieldDef = { ilFieldDef with CustomAttrs = mkILCustomAttrs [ cenv.g.DebuggerBrowsableNeverAttribute ] } let fspec = mkILFieldSpecInTy (mkILTyForCompLoc eenv.cloc,ilFieldName, fty) CountStaticFieldDef() - cgbuf.mgbuf.AddFieldDef(fspec.EnclosingTypeRef,ilFieldDef) + cgbuf.mgbuf.AddFieldDef(fspec.DeclaringTypeRef,ilFieldDef) CG.EmitInstrs cgbuf (pop 0) (Push [ ilArrayType; ilArrayType; cenv.g.iltyp_RuntimeFieldHandle ]) @@ -2171,7 +2171,7 @@ and GenAllocExn cenv cgbuf eenv (c,args,m) sequel = and GenAllocUnionCase cenv cgbuf eenv (c,tyargs,args,m) sequel = GenExprs cenv cgbuf eenv args let cuspec,idx = GenUnionCaseSpec cenv.amap m eenv.tyenv c tyargs - CG.EmitInstrs cgbuf (pop args.Length) (Push [cuspec.EnclosingType]) (EraseUnions.mkNewData cenv.g.ilg (cuspec, idx)) + CG.EmitInstrs cgbuf (pop args.Length) (Push [cuspec.DeclaringType]) (EraseUnions.mkNewData cenv.g.ilg (cuspec, idx)) GenSequel cenv eenv.cloc cgbuf sequel and GenAllocRecd cenv cgbuf eenv ctorInfo (tcref,argtys,args,m) sequel = @@ -2361,7 +2361,7 @@ and GenSetUnionCaseField cenv cgbuf eenv (e,ucref,tyargs,n,e2,m) sequel = let cuspec,idx = GenUnionCaseSpec cenv.amap m eenv.tyenv ucref tyargs let avoidHelpers = entityRefInThisAssembly cenv.g.compilingFslib ucref.TyconRef EraseUnions.emitCastData cenv.g.ilg (UnionCodeGen cgbuf) (false,avoidHelpers,cuspec,idx) - CG.EmitInstrs cgbuf (pop 1) (Push [cuspec.EnclosingType]) [ ] // push/pop to match the line above + CG.EmitInstrs cgbuf (pop 1) (Push [cuspec.DeclaringType]) [ ] // push/pop to match the line above GenExpr cenv cgbuf eenv SPSuppress e2 Continue CG.EmitInstrs cgbuf (pop 2) Push0 (EraseUnions.mkStData (cuspec, idx, n)) GenUnitThenSequel cenv eenv m eenv.cloc cgbuf sequel @@ -2406,7 +2406,7 @@ and GenFieldGet isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) = CG.EmitInstrs cgbuf (mk_field_pops isStatic 0) (Push [fspec.ActualType]) [ instr ] else let cconv = if isStatic then ILCallingConv.Static else ILCallingConv.Instance - let mspec = mkILMethSpecInTy (fspec.EnclosingType,cconv, "get_" + rfref.RecdField.rfield_id.idText, [], fspec.FormalType, []) + let mspec = mkILMethSpecInTy (fspec.DeclaringType,cconv, "get_" + rfref.RecdField.rfield_id.idText, [], fspec.FormalType, []) CG.EmitInstr cgbuf (mk_field_pops isStatic 0) (Push [fspec.ActualType]) (mkNormalCall mspec) and GenFieldStore isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) sequel = @@ -2414,7 +2414,7 @@ and GenFieldStore isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) sequel let fld = rfref.RecdField if fld.IsMutable && not (useGenuineField rfref.Tycon fld) then let cconv = if isStatic then ILCallingConv.Static else ILCallingConv.Instance - let mspec = mkILMethSpecInTy (fspec.EnclosingType, cconv, "set_" + fld.rfield_id.idText, [fspec.FormalType],ILType.Void,[]) + let mspec = mkILMethSpecInTy (fspec.DeclaringType, cconv, "set_" + fld.rfield_id.idText, [fspec.FormalType],ILType.Void,[]) CG.EmitInstr cgbuf (mk_field_pops isStatic 1) Push0 (mkNormalCall mspec) else let vol = if rfref.RecdField.IsVolatile then Volatile else Nonvolatile @@ -2603,14 +2603,14 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel = let numEnclILTypeArgs = match vref.MemberInfo with | Some _ when not (vref.IsExtensionMember) -> - List.length(vref.MemberApparentParent.TyparsNoRange |> DropErasedTypars) + List.length(vref.MemberApparentEntity.TyparsNoRange |> DropErasedTypars) | _ -> 0 let (ilEnclArgTys,ilMethArgTys) = if ilTyArgs.Length < numEnclILTypeArgs then error(InternalError("length mismatch",m)) List.chop numEnclILTypeArgs ilTyArgs - let boxity = mspec.EnclosingType.Boxity + let boxity = mspec.DeclaringType.Boxity let mspec = mkILMethSpec (mspec.MethodRef, boxity,ilEnclArgTys,ilMethArgTys) // "Unit" return types on static methods become "void" @@ -2645,7 +2645,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel = // ok, now we're ready to generate if isSuperInit || isSelfInit then - CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType ]) [ mkLdarg0 ] + CG.EmitInstrs cgbuf (pop 0) (Push [mspec.DeclaringType ]) [ mkLdarg0 ] GenUntupledArgsDiscardingLoneUnit cenv cgbuf eenv m vref.NumObjArgs curriedArgInfos nowArgs @@ -2668,7 +2668,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel = (if mustGenerateUnitAfterCall || isSuperInit || isSelfInit then Push0 else (Push [(GenType cenv.amap m eenv.tyenv actualRetTy)])) callInstr // For isSuperInit, load the 'this' pointer as the pretend 'result' of the operation. It will be popped again in most cases - if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType]) [ mkLdarg0 ] + if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.DeclaringType]) [ mkLdarg0 ] // When generating debug code, generate a 'nop' after a 'call' that returns 'void' // This is what C# does, as it allows the call location to be maintained correctly in the stack frame @@ -3098,8 +3098,8 @@ and GenAsmCode cenv cgbuf eenv (il,tyargs,args,returnTys,m) sequel = if isNil ilTyArgs then fspec else - {fspec with EnclosingType= - let ty = fspec.EnclosingType + {fspec with DeclaringType= + let ty = fspec.DeclaringType let tspec = ty.TypeSpec mkILTy ty.Boxity (mkILTySpec(tspec.TypeRef, ilTyArgs)) } match i,ilTyArgs with @@ -3306,7 +3306,7 @@ and GenILCall cenv cgbuf eenv (virt,valu,newobj,valUseFlags,isDllImport,ilMethRe // Load the 'this' pointer to pass to the superclass constructor. This argument is not // in the expression tree since it can't be treated like an ordinary value - if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.EnclosingType]) [ mkLdarg0 ] + if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.DeclaringType]) [ mkLdarg0 ] GenExprs cenv cgbuf eenv argExprs let il = if newobj then [ I_newobj(ilMethSpec,None) ] @@ -3323,7 +3323,7 @@ and GenILCall cenv cgbuf eenv (virt,valu,newobj,valUseFlags,isDllImport,ilMethRe // Load the 'this' pointer as the pretend 'result' of the isSuperInit operation. // It will be immediately popped in most cases, but may also be used as the target of some "property set" operations. - if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.EnclosingType]) [ mkLdarg0 ] + if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.DeclaringType]) [ mkLdarg0 ] CommitCallSequel cenv eenv m eenv.cloc cgbuf mustGenerateUnitAfterCall sequel and CommitCallSequel cenv eenv m cloc cgbuf mustGenerateUnitAfterCall sequel = @@ -4699,7 +4699,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta // Workaround for .NET and Visual Studio restriction w.r.t debugger type proxys // Mark internal constructors in internal classes as public. let access = - if access = ILMemberAccess.Assembly && vspec.IsConstructor && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentParent.Deref then + if access = ILMemberAccess.Assembly && vspec.IsConstructor && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentEntity.Deref then ILMemberAccess.Public else access @@ -4713,7 +4713,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta CommitStartScope cgbuf startScopeMarkOpt // The initialization code for static 'let' and 'do' bindings gets compiled into the initialization .cctor for the whole file - | _ when vspec.IsClassConstructor && isNil vspec.TopValActualParent.TyparsNoRange -> + | _ when vspec.IsClassConstructor && isNil vspec.TopValDeclaringEntity.TyparsNoRange -> let tps,_,_,_,cctorBody,_ = IteratedAdjustArityOfLambda cenv.g cenv.amap vspec.ValReprInfo.Value rhsExpr let eenv = EnvForTypars tps eenv CommitStartScope cgbuf startScopeMarkOpt @@ -4740,7 +4740,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta Init = None Args = [] CustomAttrs = mkILCustomAttrs ilAttribs } - cgbuf.mgbuf.AddOrMergePropertyDef(ilGetterMethSpec.MethodRef.EnclosingTypeRef, ilPropDef,m) + cgbuf.mgbuf.AddOrMergePropertyDef(ilGetterMethSpec.MethodRef.DeclaringTypeRef, ilPropDef,m) let ilMethodDef = let ilMethodBody = MethodBody.IL(CodeGenMethodForExpr cenv cgbuf.mgbuf (SPSuppress, [], ilGetterMethSpec.Name, eenv, 0, 0, rhsExpr, Return)) @@ -4749,7 +4749,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta |> AddNonUserCompilerGeneratedAttribs cenv.g CountMethodDef() - cgbuf.mgbuf.AddMethodDef(ilGetterMethSpec.MethodRef.EnclosingTypeRef, ilMethodDef) + cgbuf.mgbuf.AddMethodDef(ilGetterMethSpec.MethodRef.DeclaringTypeRef, ilMethodDef) CommitStartScope cgbuf startScopeMarkOpt match optShadowLocal with @@ -4794,7 +4794,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta { ilFieldDef with CustomAttrs = mkILCustomAttrs (ilAttribs @ [ cenv.g.DebuggerBrowsableNeverAttribute ]) } - [ (fspec.EnclosingTypeRef, ilFieldDef) ] + [ (fspec.DeclaringTypeRef, ilFieldDef) ] let ilTypeRefForProperty = ilTyForProperty.TypeRef @@ -5066,7 +5066,7 @@ and GenEventForProperty cenv eenvForMeth (mspec:ILMethodSpec) (v:Val) ilAttrsTha let evname = v.PropertyName let delegateTy = Infos.FindDelegateTypeOfPropertyEvent cenv.g cenv.amap evname m returnTy let ilDelegateTy = GenType cenv.amap m eenvForMeth.tyenv delegateTy - let ilThisTy = mspec.EnclosingType + let ilThisTy = mspec.DeclaringType let addMethRef = mkILMethRef (ilThisTy.TypeRef,mspec.CallingConv,"add_" + evname,0,[ilDelegateTy],ILType.Void) let removeMethRef = mkILMethRef (ilThisTy.TypeRef,mspec.CallingConv,"remove_" + evname,0,[ilDelegateTy],ILType.Void) { Type = Some(ilDelegateTy) @@ -5087,7 +5087,7 @@ and ComputeFlagFixupsForMemberBinding cenv (v:Val,memberInfo:ValMemberInfo) = memberInfo.ImplementedSlotSigs |> List.map (fun slotsig -> let oty = slotsig.ImplementedType let otcref,_ = destAppTy cenv.g oty - let tcref = v.MemberApparentParent + let tcref = v.MemberApparentEntity let useMethodImpl = // REVIEW: it would be good to get rid of this special casing of Compare and GetHashCode during code generation @@ -5238,7 +5238,7 @@ and GenMethodForBinding let ilParams = GenParams cenv eenv mspec paramInfos (Some(nonUnitNonSelfMethodVars)) let ilReturn = GenReturnInfo cenv eenv mspec.FormalReturnType retInfo let methName = mspec.Name - let tref = mspec.MethodRef.EnclosingTypeRef + let tref = mspec.MethodRef.DeclaringTypeRef let EmitTheMethodDef mdef = // Does the function have an explicit [] attribute? @@ -5275,7 +5275,7 @@ and GenMethodForBinding () | Some(memberInfo) when not v.IsExtensionMember -> - let ilMethTypars = ilTypars |> List.drop mspec.EnclosingType.GenericArgs.Length + let ilMethTypars = ilTypars |> List.drop mspec.DeclaringType.GenericArgs.Length if memberInfo.MemberFlags.MemberKind = MemberKind.Constructor then assert (isNil ilMethTypars) let mdef = mkILCtor (access,ilParams,ilMethodBody) @@ -5309,7 +5309,7 @@ and GenMethodForBinding let isAbstract = memberInfo.MemberFlags.IsDispatchSlot && - let tcref = v.MemberApparentParent + let tcref = v.MemberApparentEntity not tcref.Deref.IsFSharpDelegateTycon let mdef = @@ -7016,7 +7016,7 @@ let LookupGeneratedValue (amap:ImportMap) (ctxt: ExecutionContext) eenv (v:Val) | StaticField (fspec, _, hasLiteralAttr, ilContainerTy, _, _, ilGetterMethRef, _, _) -> let obj = if hasLiteralAttr then - let staticTyp = ctxt.LookupTypeRef fspec.EnclosingTypeRef + let staticTyp = ctxt.LookupTypeRef fspec.DeclaringTypeRef // Checked: This FieldInfo (FieldBuilder) supports GetValue(). staticTyp.GetField(fspec.Name).GetValue(null:obj) else @@ -7030,7 +7030,7 @@ let LookupGeneratedValue (amap:ImportMap) (ctxt: ExecutionContext) eenv (v:Val) | StaticProperty (ilGetterMethSpec, _) -> let obj = - let staticTyp = ctxt.LookupTypeRef ilGetterMethSpec.MethodRef.EnclosingTypeRef + let staticTyp = ctxt.LookupTypeRef ilGetterMethSpec.MethodRef.DeclaringTypeRef // We can't call .Invoke on the ILMethodRef's MethodInfo, // because it is the MethodBuilder and that does not support Invoke. // Rather, we look for the getter MethodInfo from the built type and .Invoke on that. @@ -7057,7 +7057,7 @@ let ClearGeneratedValue (ctxt: ExecutionContext) (_g:TcGlobals) eenv (v:Val) = match StorageForVal v.Range v eenv with | StaticField (fspec, _, hasLiteralAttr, _, _, _, _ilGetterMethRef, ilSetterMethRef, _) -> if not hasLiteralAttr && v.IsMutable then - let staticTyp = ctxt.LookupTypeRef ilSetterMethRef.EnclosingTypeRef + let staticTyp = ctxt.LookupTypeRef ilSetterMethRef.DeclaringTypeRef let typ = ctxt.LookupType fspec.ActualType let methInfo = staticTyp.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) diff --git a/src/fsharp/InfoReader.fs b/src/fsharp/InfoReader.fs index 25f7547e47..eabc0bf862 100644 --- a/src/fsharp/InfoReader.fs +++ b/src/fsharp/InfoReader.fs @@ -4,6 +4,8 @@ /// Select members from a type by name, searching the type hierarchy if needed module internal Microsoft.FSharp.Compiler.InfoReader +open System.Collections.Generic + open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library @@ -46,12 +48,10 @@ let TrySelectMemberVal g optFilter typ pri _membInfo (vref:ValRef) = else None -/// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter -/// parameter is an optional name to restrict the set of properties returned. -let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ = - let minfos = +let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m origTy metadataTy = - match metadataOfTy g typ with + let minfos = + match metadataOfTy g metadataTy with #if !NO_EXTENSIONTYPING | ProvidedTypeMetadata info -> let st = info.ProvidedType @@ -59,33 +59,48 @@ let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ = match optFilter with | Some name -> st.PApplyArray ((fun st -> st.GetMethods() |> Array.filter (fun mi -> mi.Name = name) ), "GetMethods", m) | None -> st.PApplyArray ((fun st -> st.GetMethods()), "GetMethods", m) - [ for mi in meths -> ProvidedMeth(amap,mi.Coerce(m),None,m) ] + [ for mi in meths -> ProvidedMeth(amap, mi.Coerce(m), None, m) ] #endif - | ILTypeMetadata (TILObjectReprData(_,_,tdef)) -> - let mdefs = tdef.Methods - let mdefs = (match optFilter with None -> mdefs.AsList | Some nm -> mdefs.FindByName nm) - mdefs |> List.map (fun mdef -> MethInfo.CreateILMeth(amap, m, typ, mdef)) + | ILTypeMetadata _ -> + let tinfo = ILTypeInfo.FromType g origTy + let mdefs = tinfo.RawMetadata.Methods + let mdefs = match optFilter with None -> mdefs.AsList | Some nm -> mdefs.FindByName nm + mdefs |> List.map (fun mdef -> MethInfo.CreateILMeth(amap, m, origTy, mdef)) + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> - match tryDestAppTy g typ with - | None -> [] - | Some tcref -> - SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter typ None) tcref + // Tuple types also support the properties Item1-8, Rest from the compiled tuple type + // In this case convert to the .NET Tuple type that carries metadata and try again + if isAnyTupleTy g metadataTy then + let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m origTy betterMetadataTy + else + match tryDestAppTy g metadataTy with + | None -> [] + | Some tcref -> + SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter origTy None) tcref let minfos = minfos |> List.filter (IsMethInfoAccessible amap m ad) minfos +/// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter +/// parameter is an optional name to restrict the set of properties returned. +let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ = + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m typ typ + /// A helper type to help collect properties. /// /// Join up getters and setters which are not associated in the F# data structure -type PropertyCollector(g,amap,m,typ,optFilter,ad) = +type PropertyCollector(g, amap, m, typ, optFilter, ad) = let hashIdentity = - Microsoft.FSharp.Collections.HashIdentity.FromFunctions + HashIdentity.FromFunctions (fun (pinfo:PropInfo) -> hash pinfo.PropertyName) (fun pinfo1 pinfo2 -> pinfo1.IsStatic = pinfo2.IsStatic && PropInfosEquivByNameAndPartialSig EraseNone g amap m pinfo1 pinfo2 && pinfo1.IsDefiniteFSharpOverride = pinfo2.IsDefiniteFSharpOverride ) - let props = new System.Collections.Generic.Dictionary(hashIdentity) + + let props = new Dictionary(hashIdentity) + let add pinfo = if props.ContainsKey(pinfo) then match props.[pinfo], pinfo with @@ -115,12 +130,10 @@ type PropertyCollector(g,amap,m,typ,optFilter,ad) = member x.Close() = [ for KeyValue(_,pinfo) in props -> pinfo ] -/// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter -/// parameter is an optional name to restrict the set of properties returned. -let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ = - let pinfos = +let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m origTy metadataTy = - match metadataOfTy g typ with + let pinfos = + match metadataOfTy g metadataTy with #if !NO_EXTENSIONTYPING | ProvidedTypeMetadata info -> let st = info.ProvidedType @@ -133,27 +146,38 @@ let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ = | None -> st.PApplyArray((fun st -> st.GetProperties()), "GetProperties", m) matchingProps - |> Seq.map(fun pi -> ProvidedProp(amap,pi,m)) + |> Seq.map(fun pi -> ProvidedProp(amap, pi, m)) |> List.ofSeq #endif - | ILTypeMetadata (TILObjectReprData(_,_,tdef)) -> - let tinfo = ILTypeInfo.FromType g typ - let pdefs = tdef.Properties + + | ILTypeMetadata _ -> + let tinfo = ILTypeInfo.FromType g origTy + let pdefs = tinfo.RawMetadata.Properties let pdefs = match optFilter with None -> pdefs.AsList | Some nm -> pdefs.LookupByName nm - pdefs |> List.map (fun pd -> ILProp(g,ILPropInfo(tinfo,pd))) + pdefs |> List.map (fun pdef -> ILProp(ILPropInfo(tinfo, pdef))) + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> - match tryDestAppTy g typ with - | None -> [] - | Some tcref -> - let propCollector = new PropertyCollector(g,amap,m,typ,optFilter,ad) - SelectImmediateMemberVals g None - (fun membInfo vref -> propCollector.Collect(membInfo,vref); None) - tcref |> ignore - propCollector.Close() + // Tuple types also support the properties Item1-8, Rest from the compiled tuple type + // In this case convert to the .NET Tuple type that carries metadata and try again + if isAnyTupleTy g metadataTy then + let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy + GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m origTy betterMetadataTy + else + match tryDestAppTy g metadataTy with + | None -> [] + | Some tcref -> + let propCollector = new PropertyCollector(g, amap, m, origTy, optFilter, ad) + SelectImmediateMemberVals g None (fun membInfo vref -> propCollector.Collect(membInfo, vref); None) tcref |> ignore + propCollector.Close() let pinfos = pinfos |> List.filter (IsPropInfoAccessible g amap m ad) pinfos +/// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter +/// parameter is an optional name to restrict the set of properties returned. +let rec GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ = + GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m typ typ + // Checks whether the given type has an indexer property. let IsIndexerType g amap typ = isArray1DTy g typ || @@ -161,9 +185,9 @@ let IsIndexerType g amap typ = match tryDestAppTy g typ with | Some tcref -> let _, entityTy = generalizeTyconRef tcref - let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy + let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy props |> List.exists (fun x -> x.PropertyName = "Item") - | _ -> false + | None -> false /// Sets of methods up the hierarchy, ignoring duplicates by name and sig. @@ -178,10 +202,10 @@ type HierarchyItem = /// An InfoReader is an object to help us read and cache infos. /// We create one of these for each file we typecheck. -type InfoReader(g:TcGlobals, amap:Import.ImportMap) = +type InfoReader(g: TcGlobals, amap: Import.ImportMap) = /// Get the declared IL fields of a type, not including inherited fields - let GetImmediateIntrinsicILFieldsOfType (optFilter,ad) m typ = + let GetImmediateIntrinsicILFieldsOfType (optFilter, ad) m typ = let infos = match metadataOfTy g typ with #if !NO_EXTENSIONTYPING @@ -195,9 +219,9 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = | Tainted.Null -> [] | fi -> [ ProvidedField(amap,fi,m) ] #endif - | ILTypeMetadata (TILObjectReprData(_,_,tdef)) -> + | ILTypeMetadata _ -> let tinfo = ILTypeInfo.FromType g typ - let fdefs = tdef.Fields + let fdefs = tinfo.RawMetadata.Fields let fdefs = match optFilter with None -> fdefs.AsList | Some nm -> fdefs.LookupByName nm fdefs |> List.map (fun pd -> ILFieldInfo(tinfo,pd)) | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> @@ -205,8 +229,8 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = let infos = infos |> List.filter (IsILFieldInfoAccessible g amap m ad) infos - /// Get the declared events of a type, not including inherited events - let ComputeImmediateIntrinsicEventsOfType (optFilter,ad) m typ = + /// Get the declared events of a type, not including inherited events, and not including F#-declared CLIEvents + let ComputeImmediateIntrinsicEventsOfType (optFilter, ad) m typ = let infos = match metadataOfTy g typ with #if !NO_EXTENSIONTYPING @@ -220,14 +244,14 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = | Tainted.Null -> [] | ei -> [ ProvidedEvent(amap,ei,m) ] #endif - | ILTypeMetadata (TILObjectReprData(_,_,tdef)) -> + | ILTypeMetadata _ -> let tinfo = ILTypeInfo.FromType g typ - let edefs = tdef.Events + let edefs = tinfo.RawMetadata.Events let edefs = match optFilter with None -> edefs.AsList | Some nm -> edefs.LookupByName nm [ for edef in edefs do - let einfo = ILEventInfo(tinfo,edef) - if IsILEventInfoAccessible g amap m ad einfo then - yield ILEvent(g,einfo) ] + let ileinfo = ILEventInfo(tinfo,edef) + if IsILEventInfoAccessible g amap m ad ileinfo then + yield ILEvent ileinfo ] | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> [] infos @@ -237,7 +261,7 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = RecdFieldInfo(argsOfAppTy g typ,tcref.MakeNestedRecdFieldRef fspec) /// Get the F#-declared record fields or class 'val' fields of a type - let GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter,_ad) _m typ = + let GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter, _ad) _m typ = match tryDestAppTy g typ with | None -> [] | Some tcref -> @@ -283,7 +307,7 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = let optFilter = Some nm FoldPrimaryHierarchyOfType (fun typ acc -> let minfos = GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ - let pinfos = GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ + let pinfos = GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ let finfos = GetImmediateIntrinsicILFieldsOfType (optFilter,ad) m typ let einfos = ComputeImmediateIntrinsicEventsOfType (optFilter,ad) m typ let rfinfos = GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter,ad) m typ @@ -414,41 +438,48 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) = primaryTypeHierarchyCache.Apply((allowMultiIntfInst,m,typ)) -//------------------------------------------------------------------------- -// Constructor infos - - /// Get the declared constructors of any F# type -let GetIntrinsicConstructorInfosOfType (infoReader:InfoReader) m ty = +let rec GetIntrinsicConstructorInfosOfTypeAux (infoReader:InfoReader) m origTy metadataTy = protectAssemblyExploration [] (fun () -> let g = infoReader.g let amap = infoReader.amap - if isAppTy g ty then - match metadataOfTy g ty with + match metadataOfTy g metadataTy with #if !NO_EXTENSIONTYPING - | ProvidedTypeMetadata info -> - let st = info.ProvidedType - [ for ci in st.PApplyArray((fun st -> st.GetConstructors()), "GetConstructors", m) do - yield ProvidedMeth(amap,ci.Coerce(m),None,m) ] + | ProvidedTypeMetadata info -> + let st = info.ProvidedType + [ for ci in st.PApplyArray((fun st -> st.GetConstructors()), "GetConstructors", m) do + yield ProvidedMeth(amap,ci.Coerce(m),None,m) ] #endif - | ILTypeMetadata _ -> - let tinfo = ILTypeInfo.FromType g ty - tinfo.RawMetadata.Methods.FindByName ".ctor" - |> List.filter (fun md -> match md.mdKind with MethodKind.Ctor -> true | _ -> false) - |> List.map (fun mdef -> MethInfo.CreateILMeth (amap, m, ty, mdef)) - - | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> - let tcref = tcrefOfAppTy g ty - tcref.MembersOfFSharpTyconByName - |> NameMultiMap.find ".ctor" - |> List.choose(fun vref -> - match vref.MemberInfo with - | Some membInfo when (membInfo.MemberFlags.MemberKind = MemberKind.Constructor) -> Some vref - | _ -> None) - |> List.map (fun x -> FSMeth(g,ty,x,None)) - else [] + | ILTypeMetadata _ -> + let tinfo = ILTypeInfo.FromType g origTy + tinfo.RawMetadata.Methods.FindByName ".ctor" + |> List.filter (fun md -> match md.mdKind with MethodKind.Ctor -> true | _ -> false) + |> List.map (fun mdef -> MethInfo.CreateILMeth (amap, m, origTy, mdef)) + + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> + // Tuple types also support the properties Item1-8, Rest from the compiled tuple type + // In this case convert to the .NET Tuple type that carries metadata and try again + if isAnyTupleTy g metadataTy then + let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy + GetIntrinsicConstructorInfosOfTypeAux infoReader m origTy betterMetadataTy + else + match tryDestAppTy g metadataTy with + | None -> [] + | Some tcref -> + tcref.MembersOfFSharpTyconByName + |> NameMultiMap.find ".ctor" + |> List.choose(fun vref -> + match vref.MemberInfo with + | Some membInfo when (membInfo.MemberFlags.MemberKind = MemberKind.Constructor) -> Some vref + | _ -> None) + |> List.map (fun x -> FSMeth(g, origTy, x, None)) ) +let GetIntrinsicConstructorInfosOfType infoReader m typ = + GetIntrinsicConstructorInfosOfTypeAux infoReader m typ typ + + + //------------------------------------------------------------------------- // Collecting methods and properties taking into account hiding rules in the hierarchy @@ -601,7 +632,7 @@ let ExcludeHiddenOfMethInfos g amap m (minfos:MethInfo list list) = (fun minfo -> minfo.LogicalName) (fun m1 m2 -> // only hide those truly from super classes - not (tyconRefEq g (tcrefOfAppTy g m1.EnclosingType) (tcrefOfAppTy g m2.EnclosingType)) && + not (tyconRefEq g m1.DeclaringTyconRef m2.DeclaringTyconRef) && MethInfosEquivByNameAndPartialSig EraseNone true g amap m m1 m2) |> List.concat diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index fd442d1f09..31e2c960f3 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -295,7 +295,7 @@ type CalledMeth<'T> [] let assignedNamedProps,unassignedNamedItems = - let returnedObjTy = if minfo.IsConstructor then minfo.EnclosingType else methodRetTy + let returnedObjTy = if minfo.IsConstructor then minfo.ApparentEnclosingType else methodRetTy unassignedNamedItems |> List.splitChoose (fun (CallerNamedArg(id,e) as arg) -> let nm = id.idText let pinfos = GetIntrinsicPropInfoSetsOfType infoReader (Some(nm),ad,AllowMultiIntfInstantiations.Yes) IgnoreOverrides id.idRange returnedObjTy @@ -509,7 +509,7 @@ let IsBaseCall objArgs = let ComputeConstrainedCallInfo g amap m (objArgs,minfo:MethInfo) = match objArgs with | [objArgExpr] when not minfo.IsExtensionMember -> - let methObjTy = minfo.EnclosingType + let methObjTy = minfo.ApparentEnclosingType let objArgTy = tyOfExpr g objArgExpr if TypeDefinitelySubsumesTypeNoCoercion 0 g amap m methObjTy objArgTy // Constrained calls to class types can only ever be needed for the three class types that @@ -546,8 +546,8 @@ let TakeObjAddrForMethodCall g amap (minfo:MethInfo) isMutable m objArgs f = // Extension members and calls to class constraints may need a coercion for their object argument let objArgExpr' = if Option.isNone ccallInfo && // minfo.IsExtensionMember && minfo.IsStruct && - not (TypeDefinitelySubsumesTypeNoCoercion 0 g amap m minfo.EnclosingType objArgTy) then - mkCoerceExpr(objArgExpr',minfo.EnclosingType,m,objArgTy) + not (TypeDefinitelySubsumesTypeNoCoercion 0 g amap m minfo.ApparentEnclosingType objArgTy) then + mkCoerceExpr(objArgExpr',minfo.ApparentEnclosingType,m,objArgTy) else objArgExpr' @@ -717,7 +717,7 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA // TODO: there is a fair bit of duplication here with mk_il_minfo_call. We should be able to merge these /// Build an expression node that is a call to a extension method in a generated assembly - let enclTy = minfo.EnclosingType + let enclTy = minfo.ApparentEnclosingType // prohibit calls to methods that are declared in specific array types (Get,Set,Address) // these calls are provided by the runtime and should not be called from the user code if isArrayTy g enclTy then diff --git a/src/fsharp/MethodOverrides.fs b/src/fsharp/MethodOverrides.fs index 44e8cf6744..fdaab28249 100644 --- a/src/fsharp/MethodOverrides.fs +++ b/src/fsharp/MethodOverrides.fs @@ -83,7 +83,7 @@ module DispatchSlotChecking = let (CompiledSig (argTys,retTy,fmtps,ttpinst)) = CompiledSigOfMeth g amap m minfo let isFakeEventProperty = minfo.IsFSharpEventPropertyMethod - Override(parentType,tcrefOfAppTy g minfo.EnclosingType,mkSynId m nm, (fmtps,ttpinst),argTys,retTy,isFakeEventProperty,false) + Override(parentType, minfo.ApparentEnclosingTyconRef, mkSynId m nm, (fmtps,ttpinst),argTys,retTy,isFakeEventProperty,false) /// Get the override info for a value being used to implement a dispatch slot. let GetTypeMemberOverrideInfo g reqdTy (overrideBy:ValRef) = @@ -121,7 +121,7 @@ module DispatchSlotChecking = //CanImplementAnySlot <<----- Change to this to enable implicit interface implementation let isFakeEventProperty = overrideBy.IsFSharpEventProperty(g) - Override(implKind,overrideBy.MemberApparentParent, mkSynId overrideBy.Range nm, (memberMethodTypars,memberToParentInst),argTys,retTy,isFakeEventProperty, overrideBy.IsCompilerGenerated) + Override(implKind,overrideBy.MemberApparentEntity, mkSynId overrideBy.Range nm, (memberMethodTypars,memberToParentInst),argTys,retTy,isFakeEventProperty, overrideBy.IsCompilerGenerated) /// Get the override information for an object expression method being used to implement dispatch slots let GetObjectExprOverrideInfo g amap (implty, id:Ident, memberFlags, ty, arityInfo, bindingAttribs, rhsExpr) = @@ -160,9 +160,8 @@ module DispatchSlotChecking = (match overrideBy.CanImplement with | CanImplementNoSlots -> false | CanImplementAnySlot -> true - | CanImplementAnyClassHierarchySlot -> not (isInterfaceTy g dispatchSlot.EnclosingType) - //| CanImplementSpecificInterfaceSlot parentTy -> isInterfaceTy g dispatchSlot.EnclosingType && typeEquiv g parentTy dispatchSlot.EnclosingType - | CanImplementAnyInterfaceSlot -> isInterfaceTy g dispatchSlot.EnclosingType) + | CanImplementAnyClassHierarchySlot -> not (isInterfaceTy g dispatchSlot.ApparentEnclosingType) + | CanImplementAnyInterfaceSlot -> isInterfaceTy g dispatchSlot.ApparentEnclosingType) /// Check if the kinds of type parameters match between a dispatch slot and an override. let IsTyparKindMatch g amap m (dispatchSlot:MethInfo) (Override(_,_,_,(mtps,_),_,_,_,_)) = @@ -236,7 +235,7 @@ module DispatchSlotChecking = let OverrideImplementsDispatchSlot g amap m dispatchSlot availPriorOverride = IsExactMatch g amap m dispatchSlot availPriorOverride && // The override has to actually be in some subtype of the dispatch slot - ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef availPriorOverride.BoundingTyconRef) (tcrefOfAppTy g dispatchSlot.EnclosingType) + ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef availPriorOverride.BoundingTyconRef) dispatchSlot.DeclaringTyconRef /// Check if a dispatch slot is already implemented let DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed (dispatchSlot: MethInfo) = @@ -363,11 +362,11 @@ module DispatchSlotChecking = | [dispatchSlot] -> - if dispatchSlot.IsFinal && (isObjExpr || not (typeEquiv g reqdTy dispatchSlot.EnclosingType)) then + if dispatchSlot.IsFinal && (isObjExpr || not (typeEquiv g reqdTy dispatchSlot.ApparentEnclosingType)) then errorR(Error(FSComp.SR.typrelMethodIsSealed(NicePrint.stringOfMethInfo amap m denv dispatchSlot),m)) | dispatchSlots -> match dispatchSlots |> List.filter (fun dispatchSlot -> - isInterfaceTy g dispatchSlot.EnclosingType || + isInterfaceTy g dispatchSlot.ApparentEnclosingType || not (DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed dispatchSlot)) with | h1 :: h2 :: _ -> errorR(Error(FSComp.SR.typrelOverrideImplementsMoreThenOneSlot((FormatOverride denv overrideBy), (NicePrint.stringOfMethInfo amap m denv h1), (NicePrint.stringOfMethInfo amap m denv h2)),m)) @@ -375,7 +374,7 @@ module DispatchSlotChecking = // dispatch slots are ordered from the derived classes to base // so we can check the topmost dispatch slot if it is final match dispatchSlots with - | meth::_ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (meth.EnclosingType.ToString()) (meth.LogicalName))), m)) + | meth::_ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (meth.ApparentEnclosingType.ToString()) (meth.LogicalName))), m)) | _ -> () @@ -452,6 +451,7 @@ module DispatchSlotChecking = // Is a member an abstract slot of one of the implied interface types? let isImpliedInterfaceType ty = + isAppTy g ty && isImpliedInterfaceTable.ContainsKey (tcrefOfAppTy g ty) && impliedTys |> List.exists (TypesFeasiblyEquiv 0 g amap reqdTyRange ty) @@ -505,7 +505,7 @@ module DispatchSlotChecking = // We also collect up the properties. This is used for abstract slot inference when overriding properties let isRelevantRequiredProperty (x:PropInfo) = (x.IsVirtualProperty && not (isInterfaceTy g reqdTy)) || - isImpliedInterfaceType x.EnclosingType + isImpliedInterfaceType x.ApparentEnclosingType let reqdProperties = GetIntrinsicPropInfosOfType infoReader (None,AccessibleFromSomewhere,AllowMultiIntfInstantiations.Yes) IgnoreOverrides reqdTyRange reqdTy @@ -609,7 +609,7 @@ module DispatchSlotChecking = let overridenForThisSlotImplSet = [ for (RequiredSlot(dispatchSlot,_)) in NameMultiMap.find overrideByInfo.LogicalName dispatchSlotsKeyed do if OverrideImplementsDispatchSlot g amap m dispatchSlot overrideByInfo then - if tyconRefEq g overrideByInfo.BoundingTyconRef (tcrefOfAppTy g dispatchSlot.EnclosingType) then + if tyconRefEq g overrideByInfo.BoundingTyconRef dispatchSlot.DeclaringTyconRef then match dispatchSlot.ArbitraryValRef with | Some virtMember -> if virtMember.MemberInfo.Value.IsImplemented then errorR(Error(FSComp.SR.tcDefaultImplementationAlreadyExists(),overrideByInfo.Range)) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 8749998957..dcbc1f074e 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -517,7 +517,7 @@ let AddValRefsToItems (bulkAddMode: BulkAdd) (eUnqualifiedItems: LayeredMap<_,_> /// Add an F# value to the table of available extension members, if necessary, as an FSharp-style extension member let AddValRefToExtensionMembers pri (eIndexedExtensionMembers: TyconRefMultiMap<_>) (vref:ValRef) = if vref.IsMember && vref.IsExtensionMember then - eIndexedExtensionMembers.Add (vref.MemberApparentParent, FSExtMem (vref,pri)) + eIndexedExtensionMembers.Add (vref.MemberApparentEntity, FSExtMem (vref,pri)) else eIndexedExtensionMembers @@ -853,7 +853,8 @@ let AddDeclaredTyparsToNameEnv check nenv typars = /// a fresh set of inference type variables for the type parameters of the union type. let FreshenTycon (ncenv: NameResolver) m (tcref:TyconRef) = let tinst = ncenv.InstantiationGenerator m (tcref.Typars m) - TType_app(tcref,tinst) + let improvedTy = ncenv.g.decompileType tcref tinst + improvedTy /// Convert a reference to a union case into a UnionCaseInfo that includes /// a fresh set of inference type variables for the type parameters of the union type. @@ -1299,7 +1300,7 @@ let (|EntityUse|_|) (item: Item) = | Item.DelegateCtor(AbbrevOrAppTy tcref) | Item.FakeInterfaceCtor(AbbrevOrAppTy tcref) -> Some tcref | Item.CtorGroup(_, ctor::_) -> - match ctor.EnclosingType with + match ctor.ApparentEnclosingType with | AbbrevOrAppTy tcref -> Some tcref | _ -> None | _ -> None @@ -1609,7 +1610,7 @@ let CheckAllTyparsInferrable amap m item = | Item.Property(_,pinfos) -> pinfos |> List.forall (fun pinfo -> pinfo.IsExtensionMember || - let freeInDeclaringType = freeInType CollectTyparsNoCaching pinfo.EnclosingType + let freeInDeclaringType = freeInType CollectTyparsNoCaching pinfo.ApparentEnclosingType let freeInArgsAndRetType = accFreeInTypes CollectTyparsNoCaching (pinfo.GetParamTypes(amap,m)) (freeInType CollectTyparsNoCaching (pinfo.GetPropertyType(amap,m))) @@ -1620,7 +1621,7 @@ let CheckAllTyparsInferrable amap m item = minfos |> List.forall (fun minfo -> minfo.IsExtensionMember || let fminst = minfo.FormalMethodInst - let freeInDeclaringType = freeInType CollectTyparsNoCaching minfo.EnclosingType + let freeInDeclaringType = freeInType CollectTyparsNoCaching minfo.ApparentEnclosingType let freeInArgsAndRetType = List.foldBack (accFreeInTypes CollectTyparsNoCaching) (minfo.GetParamTypes(amap, m, fminst)) (accFreeInTypes CollectTyparsNoCaching (minfo.GetObjArgTypes(amap, m, fminst)) @@ -1859,11 +1860,12 @@ let private ResolveObjectConstructorPrim (ncenv:NameResolver) edenv resInfo m ad then [DefaultStructCtor(g,typ)] else [] - if (isNil defaultStructCtorInfo && isNil ctorInfos) || not (isAppTy g typ) then + if (isNil defaultStructCtorInfo && isNil ctorInfos) || (not (isAppTy g typ) && not (isAnyTupleTy g typ)) then raze (Error(FSComp.SR.nrNoConstructorsAvailableForType(NicePrint.minimalStringOfType edenv typ),m)) else let ctorInfos = ctorInfos |> List.filter (IsMethInfoAccessible amap m ad) - success (resInfo,Item.MakeCtorGroup ((tcrefOfAppTy g typ).LogicalName, (defaultStructCtorInfo@ctorInfos))) + let metadataTy = helpEnsureTypeHasMetadata g typ + success (resInfo,Item.MakeCtorGroup ((tcrefOfAppTy g metadataTy).LogicalName, (defaultStructCtorInfo@ctorInfos))) /// Perform name resolution for an identifier which must resolve to be an object constructor. let ResolveObjectConstructor (ncenv:NameResolver) edenv m ad typ = @@ -1906,7 +1908,7 @@ let ExtensionPropInfosOfTypeInScope (infoReader:InfoReader) (nenv: NameResolutio let extMemsFromHierarchy = infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,typ) |> List.collect (fun typ -> - if (isAppTy g typ) then + if isAppTy g typ then let tcref = tcrefOfAppTy g typ let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref SelectPropInfosFromExtMembers (infoReader,ad,optFilter) typ m extMemInfos @@ -1969,7 +1971,7 @@ let ExtensionMethInfosOfTypeInScope (infoReader:InfoReader) (nenv: NameResolutio let extMemsFromHierarchy = infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,typ) |> List.collect (fun typ -> let g = infoReader.g - if (isAppTy g typ) then + if isAppTy g typ then let tcref = tcrefOfAppTy g typ let extValRefs = nenv.eIndexedExtensionMembers.Find tcref SelectMethInfosFromExtMembers infoReader optFilter typ m extValRefs @@ -2010,7 +2012,7 @@ let CoreDisplayName(pinfo:PropInfo) = | FSProp(_,_,_,Some set) -> set.CoreDisplayName | FSProp(_,_,Some get,_) -> get.CoreDisplayName | FSProp _ -> failwith "unexpected (property must have either getter or setter)" - | ILProp(_,ILPropInfo(_,def)) -> def.Name + | ILProp(ILPropInfo(_,def)) -> def.Name #if !NO_EXTENSIONTYPING | ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.Name), m) #endif @@ -2019,8 +2021,8 @@ let DecodeFSharpEvent (pinfos:PropInfo list) ad g (ncenv:NameResolver) m = match pinfos with | [pinfo] when pinfo.IsFSharpEventProperty -> let nm = CoreDisplayName(pinfo) - let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+nm),ad) g ncenv.amap m pinfo.EnclosingType - let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+nm),ad) g ncenv.amap m pinfo.EnclosingType + let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+nm),ad) g ncenv.amap m pinfo.ApparentEnclosingType + let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+nm),ad) g ncenv.amap m pinfo.ApparentEnclosingType match minfos1,minfos2 with | [FSMeth(_,_,addValRef,_)],[FSMeth(_,_,removeValRef,_)] -> // FOUND PROPERTY-AS-EVENT AND CORRESPONDING ADD/REMOVE METHODS @@ -2246,7 +2248,7 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv (typeN match typeNameResInfo.ResolutionFlag with | ResolveTypeNamesToTypeRefs -> success [ for (resInfo,tcref) in tcrefs do - let typ = FreshenTycon ncenv m tcref + let typ = FreshenTycon ncenv m tcref let item = (resInfo,Item.Types(id.idText,[typ]),[]) yield item ] | ResolveTypeNamesToCtors -> @@ -3483,6 +3485,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso not x.IsSpecialName && x.IsStatic = statics && IsILFieldInfoAccessible g amap m ad x) + let pinfosIncludingUnseen = AllPropInfosOfTypeInScope ncenv.InfoReader nenv (None,ad) PreferOverrides m typ |> List.filter (fun x -> @@ -3506,8 +3509,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso let (SigOfFunctionForDelegate(invokeMethInfo,_,_,_)) = GetSigOfFunctionForDelegate ncenv.InfoReader delegateType m ad // Only events with void return types are suppressed in intellisense. if slotSigHasVoidReturnTy (invokeMethInfo.GetSlotSig(amap, m)) then - yield einfo.GetAddMethod().DisplayName - yield einfo.GetRemoveMethod().DisplayName ] + yield einfo.AddMethod.DisplayName + yield einfo.RemoveMethod.DisplayName ] else [] let suppressedMethNames = Zset.ofList String.order (pinfoMethNames @ einfoMethNames) @@ -3521,6 +3524,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso match completionTargets with | ResolveCompletionTargets.All x -> x | _ -> failwith "internal error: expected completionTargets = ResolveCompletionTargets.All" + // Only show the Finalize, MemberwiseClose etc. methods on System.Object for values whose static type really is // System.Object. Few of these are typically used from F#. // @@ -3530,10 +3534,10 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso not minfo.IsExtensionMember && match minfo.LogicalName with | "GetType" -> false - | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) + | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) | "ToString" -> false | "Equals" -> - if not (isObjTy g minfo.EnclosingType) then + if not (isObjTy g minfo.ApparentEnclosingType) then // declaring type is not System.Object - show it false elif minfo.IsInstance then @@ -3544,7 +3548,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso true | _ -> // filter out self methods of obj type - isObjTy g minfo.EnclosingType + isObjTy g minfo.ApparentEnclosingType + let result = not isUnseenDueToBasicObjRules && not minfo.IsInstance = statics && @@ -3556,6 +3561,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso not (minfo.LogicalName = ".ctor") && isApplicableMeth minfo typ && not (suppressedMethNames.Contains minfo.LogicalName) + result let pinfoItems = @@ -4143,8 +4149,8 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ let (SigOfFunctionForDelegate(invokeMethInfo,_,_,_)) = GetSigOfFunctionForDelegate ncenv.InfoReader delegateType m ad // Only events with void return types are suppressed in intellisense. if slotSigHasVoidReturnTy (invokeMethInfo.GetSlotSig(amap, m)) then - yield einfo.GetAddMethod().DisplayName - yield einfo.GetRemoveMethod().DisplayName ] + yield einfo.AddMethod.DisplayName + yield einfo.RemoveMethod.DisplayName ] let suppressedMethNames = Zset.ofList String.order (pinfoMethNames @ einfoMethNames) @@ -4162,10 +4168,10 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ not minfo.IsExtensionMember && match minfo.LogicalName with | "GetType" -> false - | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) + | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) | "ToString" -> false | "Equals" -> - if not (isObjTy g minfo.EnclosingType) then + if not (isObjTy g minfo.ApparentEnclosingType) then // declaring type is not System.Object - show it false elif minfo.IsInstance then @@ -4176,7 +4182,7 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ true | _ -> // filter out self methods of obj type - isObjTy g minfo.EnclosingType + isObjTy g minfo.ApparentEnclosingType let result = not isUnseenDueToBasicObjRules && not minfo.IsInstance = statics && diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index c5a8b19ef9..85415c0590 100755 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -659,11 +659,11 @@ module private PrintTypes = match k with | ILAttrib ilMethRef -> let trimmedName = - let name = ilMethRef.EnclosingTypeRef.Name + let name = ilMethRef.DeclaringTypeRef.Name match String.tryDropSuffix name "Attribute" with | Some shortName -> shortName | None -> name - let tref = ilMethRef.EnclosingTypeRef + let tref = ilMethRef.DeclaringTypeRef let tref = ILTypeRef.Create(scope= tref.Scope, enclosing=tref.Enclosing, name=trimmedName) PrintIL.layoutILTypeRef denv tref ++ argsL | FSAttrib vref -> @@ -1111,7 +1111,7 @@ module private PrintTastMemberOrVals = DemangleOperatorNameAsLayout (tagFunction >> mkNav v.DefinitionRange) name let nameL = if denv.showMemberContainers then - layoutTyconRef denv v.MemberApparentParent ^^ SepL.dot ^^ nameL + layoutTyconRef denv v.MemberApparentEntity ^^ SepL.dot ^^ nameL else nameL let nameL = if denv.showTyparBinding then layoutTyparDecls denv nameL true niceMethodTypars else nameL @@ -1296,18 +1296,15 @@ module InfoMemberPrinting = // Container(argName1:argType1, ..., argNameN:argTypeN) : retType // Container.Method(argName1:argType1, ..., argNameN:argTypeN) : retType let private layoutMethInfoCSharpStyle amap m denv (minfo:MethInfo) minst = - let retTy = if minfo.IsConstructor then minfo.EnclosingType else minfo.GetFSharpReturnTy(amap, m, minst) + let retTy = if minfo.IsConstructor then minfo.ApparentEnclosingType else minfo.GetFSharpReturnTy(amap, m, minst) let layout = if minfo.IsExtensionMember then LeftL.leftParen ^^ wordL (tagKeyword (FSComp.SR.typeInfoExtension())) ^^ RightL.rightParen else emptyL let layout = layout ^^ - match tryDestAppTy amap.g minfo.EnclosingType with - | Some tcref -> - PrintTypes.layoutTyconRef denv tcref - | None -> - PrintTypes.layoutType denv minfo.EnclosingType + let tcref = minfo.ApparentEnclosingTyconRef + PrintTypes.layoutTyconRef denv tcref let layout = layout ^^ if minfo.IsConstructor then @@ -1357,9 +1354,9 @@ module InfoMemberPrinting = // ApparentContainer.Method(argName1:argType1, ..., argNameN:argTypeN) : retType let prettyLayoutOfMethInfoFreeStyle (amap: Import.ImportMap) m denv typarInst methInfo = match methInfo with - | DefaultStructCtor(g,_typ) -> + | DefaultStructCtor _ -> let prettyTyparInst, _ = PrettyTypes.PrettifyInst amap.g typarInst - prettyTyparInst, PrintTypes.layoutTyconRef denv (tcrefOfAppTy g methInfo.EnclosingType) ^^ wordL (tagPunctuation "()") + prettyTyparInst, PrintTypes.layoutTyconRef denv methInfo.ApparentEnclosingTyconRef ^^ wordL (tagPunctuation "()") | FSMeth(_,_,vref,_) -> let prettyTyparInst, resL = PrintTastMemberOrVals.prettyLayoutOfValOrMember { denv with showMemberContainers=true } typarInst vref.Deref prettyTyparInst, resL @@ -1383,7 +1380,7 @@ module InfoMemberPrinting = | Some vref -> tagProperty >> mkNav vref.DefinitionRange let nameL = DemangleOperatorNameAsLayout tagProp pinfo.PropertyName wordL (tagText (FSComp.SR.typeInfoProperty())) ^^ - layoutTyconRef denv (tcrefOfAppTy g pinfo.EnclosingType) ^^ + layoutTyconRef denv pinfo.ApparentEnclosingTyconRef ^^ SepL.dot ^^ nameL ^^ RightL.colon ^^ @@ -1404,7 +1401,7 @@ module private TastDefinitionPrinting = open PrintTypes let layoutExtensionMember denv (v:Val) = - let tycon = v.MemberApparentParent.Deref + let tycon = v.MemberApparentEntity.Deref let nameL = tagMethod tycon.DisplayName |> mkNav v.DefinitionRange |> wordL let nameL = layoutAccessibility denv tycon.Accessibility nameL // "type-accessibility" let tps = @@ -1557,8 +1554,8 @@ module private TastDefinitionPrinting = if p.HasGetter then yield p.GetterMethod.DisplayName if p.HasSetter then yield p.SetterMethod.DisplayName for e in events do - yield e.GetAddMethod().DisplayName - yield e.GetRemoveMethod().DisplayName ] + yield e.AddMethod.DisplayName + yield e.RemoveMethod.DisplayName ] with _ -> Set.empty let ctorLs = diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index b4ebba4567..88784272d3 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1513,7 +1513,7 @@ let (|AnyRefTupleTrans|) e = /// Look for any QueryBuilder.* operation and transform let (|AnyQueryBuilderOpTrans|_|) g = function | Expr.App((Expr.Val (vref, _, _) as v), vty, tyargs, [builder; AnyRefTupleTrans( (src::rest), replaceArgs) ], m) when - (match vref.ApparentParent with Parent tcref -> tyconRefEq g tcref g.query_builder_tcref | ParentNone -> false) -> + (match vref.ApparentEnclosingEntity with Parent tcref -> tyconRefEq g tcref g.query_builder_tcref | ParentNone -> false) -> Some (src, (fun newSource -> Expr.App(v, vty, tyargs, [builder; replaceArgs(newSource::rest)], m))) | _ -> None @@ -1814,9 +1814,9 @@ and OptimizeExprOp cenv env (op, tyargs, args, m) = // guarantees to optimize. | TOp.ILCall (_, _, _, _, _, _, _, mref, _enclTypeArgs, _methTypeArgs, _tys), _, [arg] - when (mref.EnclosingTypeRef.Scope.IsAssemblyRef && - mref.EnclosingTypeRef.Scope.AssemblyRef.Name = cenv.g.ilg.typ_Array.TypeRef.Scope.AssemblyRef.Name && - mref.EnclosingTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name && + when (mref.DeclaringTypeRef.Scope.IsAssemblyRef && + mref.DeclaringTypeRef.Scope.AssemblyRef.Name = cenv.g.ilg.typ_Array.TypeRef.Scope.AssemblyRef.Name && + mref.DeclaringTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name && mref.Name = "get_Length" && isArray1DTy cenv.g (tyOfExpr cenv.g arg)) -> OptimizeExpr cenv env (Expr.Op(TOp.ILAsm(i_ldlen, [cenv.g.int_ty]), [], [arg], m)) @@ -2523,7 +2523,7 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m) else match finfo.Info with | ValValue(vref, _) -> - match vref.ApparentParent with + match vref.ApparentEnclosingEntity with | Parent(tcr) when (tyconRefEq cenv.g cenv.g.lazy_tcr_canon tcr) -> match tcr.CompiledRepresentation with | CompiledTypeRepr.ILAsmNamed(iltr, _, _) -> iltr.Scope.AssemblyRef.Name = "FSharp.Core" @@ -2971,7 +2971,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = (vref.InlineInfo = ValInline.Never) || // MarshalByRef methods may not be inlined - (match vref.ActualParent with + (match vref.DeclaringEntity with | Parent tcref -> match cenv.g.system_MarshalByRefObject_tcref with | None -> false diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs index 7c42d19b7c..a40292a356 100644 --- a/src/fsharp/PatternMatchCompilation.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -873,7 +873,7 @@ let CompilePatternBasic let v,vexp = mkCompGenLocal m "typeTestResult" tgty if topv.IsMemberOrModuleBinding then - AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData + AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData let argexp = GetSubExprOfInput subexpr let appexp = mkIsInst tgty argexp matchm Some(vexp),Some(mkInvisibleBind v appexp) @@ -888,7 +888,7 @@ let CompilePatternBasic | None -> Some addrexp, None | Some (v,e) -> if topv.IsMemberOrModuleBinding then - AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData + AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData Some addrexp, Some (mkInvisibleBind v e) @@ -904,7 +904,7 @@ let CompilePatternBasic let ucaseTy = (mkProvenUnionCaseTy g.cons_ucref tinst) let v,vexp = mkCompGenLocal m "unionTestResult" ucaseTy if topv.IsMemberOrModuleBinding then - AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData + AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData let argexp = GetSubExprOfInput subexpr let appexp = mkIsInst ucaseTy argexp matchm Some vexp,Some (mkInvisibleBind v appexp) @@ -917,7 +917,7 @@ let CompilePatternBasic let rty = apinfo.ResultType g m resTys let v,vexp = mkCompGenLocal m ("activePatternResult"^string (newUnique())) rty if topv.IsMemberOrModuleBinding then - AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData + AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData let argexp = GetSubExprOfInput subexpr let appexp = mkApps g ((pexp,tyOfExpr g pexp), [], [argexp],m) diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index d0d2ef8da2..e999a80912 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -540,7 +540,7 @@ and CheckExpr (cenv:cenv) (env:env) expr (context:ByrefContext) = errorR(Error(FSComp.SR.chkLimitationsOfBaseKeyword(), m)) if (match vFlags with NormalValUse -> true | _ -> false) && v.IsConstructor && - (match v.ActualParent with Parent tcref -> isAbstractTycon tcref.Deref | _ -> false) then + (match v.DeclaringEntity with Parent tcref -> isAbstractTycon tcref.Deref | _ -> false) then errorR(Error(FSComp.SR.tcAbstractTypeCannotBeInstantiated(),m)) if isByrefTy cenv.g v.Type && @@ -1157,7 +1157,7 @@ and CheckBinding cenv env alwaysCheckNoReraise (TBind(v,bindRhs,_) as bind) = // Check accessibility if (v.IsMemberOrModuleBinding || v.IsMember) && not v.IsIncrClassGeneratedMember then - let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.TopValActualParent.CompilationPath) v.Accessibility + let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.TopValDeclaringEntity.CompilationPath) v.Accessibility CheckTypeForAccess cenv env (fun () -> NicePrint.stringOfQualifiedValOrMember cenv.denv v) access v.Range v.Type let env = if v.IsConstructor && not v.IsIncrClassConstructor then { env with limited=true } else env @@ -1183,9 +1183,9 @@ and CheckBinding cenv env alwaysCheckNoReraise (TBind(v,bindRhs,_) as bind) = // Also check the enclosing type for members - for historical reasons, in the TAST member values // are stored in the entity that encloses the type, hence we will not have noticed the ReflectedDefinition // on the enclosing type at this point. - HasFSharpAttribute cenv.g cenv.g.attrib_ReflectedDefinitionAttribute v.TopValActualParent.Attribs) then + HasFSharpAttribute cenv.g cenv.g.attrib_ReflectedDefinitionAttribute v.TopValDeclaringEntity.Attribs) then - if v.IsInstanceMember && v.MemberApparentParent.IsStructOrEnumTycon then + if v.IsInstanceMember && v.MemberApparentEntity.IsStructOrEnumTycon then errorR(Error(FSComp.SR.chkNoReflectedDefinitionOnStructMember(),v.Range)) cenv.usesQuotations <- true @@ -1264,10 +1264,10 @@ let CheckModuleBinding cenv env (TBind(v,e,_) as bind) = // Skip explicit implementations of interface methods if ValIsExplicitImpl cenv.g v then () else - match v.ActualParent with + match v.DeclaringEntity with | ParentNone -> () // this case can happen after error recovery from earlier error | Parent _ -> - let tcref = v.TopValActualParent + let tcref = v.TopValDeclaringEntity let hasDefaultAugmentation = tcref.IsUnionTycon && match TryFindFSharpAttribute cenv.g cenv.g.attrib_DefaultAugmentationAttribute tcref.Attribs with @@ -1336,7 +1336,7 @@ let CheckModuleBinding cenv env (TBind(v,e,_) as bind) = if v2.IsExtensionMember && not (valEq v v2) && v.CompiledName = v2.CompiledName then let minfo1 = FSMeth(cenv.g, generalizedTyconRef tcref, mkLocalValRef v, Some 0UL) let minfo2 = FSMeth(cenv.g, generalizedTyconRef tcref, mkLocalValRef v2, Some 0UL) - if tyconRefEq cenv.g v.MemberApparentParent v2.MemberApparentParent && + if tyconRefEq cenv.g v.MemberApparentEntity v2.MemberApparentEntity && MethInfosEquivByNameAndSig EraseAll true cenv.g cenv.amap v.Range minfo1 minfo2 then errorR(Duplicate(kind,v.DisplayName,v.Range))) diff --git a/src/fsharp/QuotationTranslator.fs b/src/fsharp/QuotationTranslator.fs index 177d50063d..7216a70015 100644 --- a/src/fsharp/QuotationTranslator.fs +++ b/src/fsharp/QuotationTranslator.fs @@ -130,7 +130,7 @@ let (|ModuleValueOrMemberUse|_|) g expr = Some(vref,vFlags,f,fty,tyargs,actualArgs @ args) | Expr.App(f,_fty,[],actualArgs,_) -> loop f (actualArgs @ args) - | (Expr.Val(vref,vFlags,_m) as f) when (match vref.ActualParent with ParentNone -> false | _ -> true) -> + | (Expr.Val(vref,vFlags,_m) as f) when (match vref.DeclaringEntity with ParentNone -> false | _ -> true) -> let fty = tyOfExpr g f Some(vref,vFlags,f,fty,[],args) | _ -> @@ -301,7 +301,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. // We only count one argument block for these. let callArgs = (objArgs::untupledCurriedArgs) |> List.concat - let parentTyconR = ConvTyconRef cenv vref.TopValActualParent m + let parentTyconR = ConvTyconRef cenv vref.TopValDeclaringEntity m let isNewObj = isNewObj || valUseFlags || isSelfInit // The signature types are w.r.t. to the formal context let envinner = BindFormalTypars env tps @@ -453,7 +453,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.ILAsm([ I_stfld(_,_,fspec) | I_stsfld (_,fspec) ],_),enclTypeArgs,args -> let tyargsR = ConvTypes cenv env m enclTypeArgs - let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.EnclosingTypeRef + let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.DeclaringTypeRef let argsR = ConvLValueArgs cenv env args QP.mkFieldSet( (parentTyconR, fspec.Name),tyargsR, argsR) @@ -528,7 +528,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.LValueOp(LSet,vref),[],[e] -> // Sets of module values become property sets - match vref.ActualParent with + match vref.DeclaringEntity with | Parent tcref when IsCompiledAsStaticProperty cenv.g vref.Deref -> let parentTyconR = ConvTyconRef cenv tcref m let propName = vref.CompiledName @@ -558,7 +558,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | _ -> wfail(Error(FSComp.SR.crefQuotationsCantContainDescendingForLoops(), m)) | TOp.ILCall(_,_,_,isNewObj,valUseFlags,isProp,_,ilMethRef,enclTypeArgs,methTypeArgs,_tys),[],callArgs -> - let parentTyconR = ConvILTypeRefUnadjusted cenv m ilMethRef.EnclosingTypeRef + let parentTyconR = ConvILTypeRefUnadjusted cenv m ilMethRef.DeclaringTypeRef let isNewObj = isNewObj || (match valUseFlags with CtorValUsedAsSuperInit | CtorValUsedAsSelfInit -> true | _ -> false) let methArgTypesR = List.map (ConvILType cenv env m) ilMethRef.ArgTypes let methRetTypeR = ConvILType cenv env m ilMethRef.ReturnType @@ -598,7 +598,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. and ConvLdfld cenv env m (fspec: ILFieldSpec) enclTypeArgs args = let tyargsR = ConvTypes cenv env m enclTypeArgs - let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.EnclosingTypeRef + let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.DeclaringTypeRef let argsR = ConvLValueArgs cenv env args QP.mkFieldGet( (parentTyconR, fspec.Name),tyargsR, argsR) @@ -716,7 +716,7 @@ and ConvModuleValueApp cenv env m (vref:ValRef) tyargs (args: Expr list list) = EmitDebugInfoIfNecessary cenv env m (ConvModuleValueAppCore cenv env m vref tyargs args) and ConvModuleValueAppCore cenv env m (vref:ValRef) tyargs (args: Expr list list) = - match vref.ActualParent with + match vref.DeclaringEntity with | ParentNone -> failwith "ConvModuleValueApp" | Parent(tcref) -> let isProperty = IsCompiledAsStaticProperty cenv.g vref.Deref @@ -747,7 +747,7 @@ and private ConvValRefCore holeOk cenv env m (vref:ValRef) tyargs = QP.mkThisVar(ConvType cenv env m v.Type) else let vty = v.Type - match v.ActualParent with + match v.DeclaringEntity with | ParentNone -> // References to local values are embedded by value if not holeOk then wfail(Error(FSComp.SR.crefNoSetOfHole(),m)) @@ -1030,14 +1030,14 @@ let ConvExprPublic cenv env e = let ConvMethodBase cenv env (methName, v:Val) = let m = v.Range - let parentTyconR = ConvTyconRef cenv v.TopValActualParent m + let parentTyconR = ConvTyconRef cenv v.TopValDeclaringEntity m match v.MemberInfo with | Some vspr when not v.IsExtensionMember -> let vref = mkLocalValRef v let tps,argInfos,retTy,_ = GetTypeOfMemberInMemberForm cenv.g vref - let numEnclTypeArgs = vref.MemberApparentParent.TyparsNoRange.Length + let numEnclTypeArgs = vref.MemberApparentEntity.TyparsNoRange.Length let argTys = argInfos |> List.concat |> List.map fst let isNewObj = (vspr.MemberFlags.MemberKind = MemberKind.Constructor) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index d2d378508d..8b0b40299f 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -601,13 +601,32 @@ let mkCompiledTupleTyconRef (g:TcGlobals) isStruct n = elif n = 8 then (if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr) else failwithf "mkCompiledTupleTyconRef, n = %d" n -let rec mkCompiledTupleTy g isStruct tys = - let n = List.length tys - if n < maxTuple then TType_app (mkCompiledTupleTyconRef g isStruct n, tys) +/// Convert from F# tuple types to .NET tuple types +let rec mkCompiledTupleTy g isStruct tupElemTys = + let n = List.length tupElemTys + if n < maxTuple then + TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys) else - let tysA, tysB = List.splitAfter goodTupleFields tys + let tysA, tysB = List.splitAfter goodTupleFields tupElemTys TType_app ((if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr), tysA@[mkCompiledTupleTy g isStruct tysB]) +/// Convert from F# tuple types to .NET tuple types, but only the outermost level +let mkOuterCompiledTupleTy g isStruct tupElemTys = + let n = List.length tupElemTys + if n < maxTuple then + TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys) + else + let tysA, tysB = List.splitAfter goodTupleFields tupElemTys + let tcref = (if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr) + // In the case of an 8-tuple we add the Tuple<_> marker. For other sizes we keep the type + // as a regular F# tuple type. + match tysB with + | [ tyB ] -> + let marker = TType_app (mkCompiledTupleTyconRef g isStruct 1, [tyB]) + TType_app (tcref, tysA@[marker]) + | _ -> + TType_app (tcref, tysA@[TType_tuple (TupInfo.Const isStruct, tysB)]) + //--------------------------------------------------------------------------- // Remove inference equations and abbreviations from types //--------------------------------------------------------------------------- @@ -768,8 +787,15 @@ let mkInstForAppTy g typ = | AppTy g (tcref, tinst) -> mkTyconRefInst tcref tinst | _ -> [] -let domainOfFunTy g ty = fst(destFunTy g ty) -let rangeOfFunTy g ty = snd(destFunTy g ty) +let domainOfFunTy g ty = fst (destFunTy g ty) +let rangeOfFunTy g ty = snd (destFunTy g ty) + +let helpEnsureTypeHasMetadata g ty = + if isAnyTupleTy g ty then + let (tupInfo, tupElemTys) = destAnyTupleTy g ty + mkOuterCompiledTupleTy g (evalTupInfoIsStruct tupInfo) tupElemTys + else ty + //--------------------------------------------------------------------------- // Equivalence of types up to alpha-equivalence @@ -2135,7 +2161,7 @@ let PartitionValTyparsForApparentEnclosingType g (v:Val) = | None -> error(InternalError("PartitionValTypars: not a top value", v.Range)) | Some arities -> let fullTypars, _ = destTopForallTy g arities v.Type - let parent = v.MemberApparentParent + let parent = v.MemberApparentEntity let parentTypars = parent.TyparsNoRange let nparentTypars = parentTypars.Length if nparentTypars <= fullTypars.Length then @@ -2706,8 +2732,8 @@ let superOfTycon (g:TcGlobals) (tycon:Tycon) = // AbsIL view of attributes (we read these from .NET binaries) let isILAttribByName (tencl:string list, tname: string) (attr: ILAttribute) = - (attr.Method.EnclosingType.TypeSpec.Name = tname) && - (attr.Method.EnclosingType.TypeSpec.Enclosing = tencl) + (attr.Method.DeclaringType.TypeSpec.Name = tname) && + (attr.Method.DeclaringType.TypeSpec.Enclosing = tencl) // AbsIL view of attributes (we read these from .NET binaries) let isILAttrib (tref:ILTypeRef) (attr: ILAttribute) = @@ -2727,7 +2753,7 @@ let TryDecodeILAttribute (g:TcGlobals) tref (attrs: ILAttributes) = // This one is done by name to ensure the compiler doesn't take a dependency on dereferencing a type that only exists in .NET 3.5 let ILThingHasExtensionAttribute (attrs : ILAttributes) = attrs.AsArray - |> Array.exists (fun attr -> attr.Method.EnclosingType.TypeSpec.Name = "System.Runtime.CompilerServices.ExtensionAttribute") + |> Array.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = "System.Runtime.CompilerServices.ExtensionAttribute") // F# view of attributes (these get converted to AbsIL attributes in ilxgen) let IsMatchingFSharpAttribute g (AttribInfo(_, tcref)) (Attrib(tcref2, _, _, _, _, _, _)) = tyconRefEq g tcref tcref2 @@ -3521,7 +3547,7 @@ module DebugPrint = begin (lvalopL lvop ^^ valRefL vr --- bracketL (commaListL (List.map atomL args))) |> wrap | Expr.Op (TOp.ILCall (_isVirtCall, _isProtectedCall, _valu, _isNewObjCall, _valUseFlags, _isProperty, _noTailCall, ilMethRef, tinst, minst, _tys), tyargs, args, _) -> let meth = ilMethRef.Name - wordL(tagText "ILCall") ^^ aboveListL [wordL(tagText "meth ") --- wordL (tagText ilMethRef.EnclosingTypeRef.FullName) ^^ sepL(tagText ".") ^^ wordL (tagText meth); + wordL(tagText "ILCall") ^^ aboveListL [wordL(tagText "meth ") --- wordL (tagText ilMethRef.DeclaringTypeRef.FullName) ^^ sepL(tagText ".") ^^ wordL (tagText meth); wordL(tagText "tinst ") --- listL typeL tinst; wordL(tagText "minst ") --- listL typeL minst; wordL(tagText "tyargs") --- listL typeL tyargs; @@ -4610,7 +4636,7 @@ and remapValData g tmenv (d: ValData) = let ty' = ty |> remapPossibleForallTy g tmenv { d with val_type = ty'; - val_actual_parent = d.val_actual_parent |> remapParentRef tmenv; + val_declaring_entity = d.val_declaring_entity |> remapParentRef tmenv; val_repr_info = d.val_repr_info |> Option.map (remapValReprInfo g tmenv); val_member_info = d.val_member_info |> Option.map (remapMemberInfo g d.val_range topValInfo ty ty' tmenv); val_attribs = d.val_attribs |> remapAttribs g tmenv } @@ -4928,7 +4954,7 @@ and remapMemberInfo g m topValInfo ty ty' tmenv x = let renaming, _ = mkTyparToTyparRenaming tpsOrig tps let tmenv = { tmenv with tpinst = tmenv.tpinst @ renaming } { x with - ApparentParent = x.ApparentParent |> remapTyconRef tmenv.tyconRefRemap ; + ApparentEnclosingEntity = x.ApparentEnclosingEntity |> remapTyconRef tmenv.tyconRefRemap ; ImplementedSlotSigs = x.ImplementedSlotSigs |> List.map (remapSlotSig (remapAttribs g tmenv) tmenv); } @@ -6330,7 +6356,7 @@ let mkCompilationMappingAttrForQuotationResource (g:TcGlobals) (nm, tys: ILTypeR //---------------------------------------------------------------------------- let isTypeProviderAssemblyAttr (cattr:ILAttribute) = - cattr.Method.EnclosingType.BasicQualifiedName = typeof.FullName + cattr.Method.DeclaringType.BasicQualifiedName = typeof.FullName let TryDecodeTypeProviderAssemblyAttr ilg (cattr:ILAttribute) = if isTypeProviderAssemblyAttr cattr then @@ -6910,7 +6936,7 @@ let etaExpandTypeLambda g m tps (tm, ty) = let AdjustValToTopVal (tmp:Val) parent valData = tmp.SetValReprInfo (Some valData); - tmp.val_actual_parent <- parent; + tmp.val_declaring_entity <- parent; tmp.SetIsMemberOrModuleBinding() /// For match with only one non-failing target T0, the other targets, T1... failing (say, raise exception). @@ -7079,7 +7105,7 @@ let XmlDocSigOfVal g path (v:Val) = | MemberKind.PropertyGetSet | MemberKind.PropertySet | MemberKind.PropertyGet -> "P:", v.PropertyName - let path = if v.HasTopValActualParent then prependPath path v.TopValActualParent.CompiledName else path + let path = if v.HasDeclaringEntity then prependPath path v.TopValDeclaringEntity.CompiledName else path let parentTypars, methTypars = match PartitionValTypars g v with | Some(_, memberParentTypars, memberMethodTypars, _, _) -> memberParentTypars, memberMethodTypars @@ -7341,10 +7367,10 @@ let isComInteropTy g ty = let ValSpecIsCompiledAsInstance g (v:Val) = match v.MemberInfo with | Some(membInfo) -> - // Note it doesn't matter if we pass 'v.TopValActualParent' or 'v.MemberApparentParent' here. + // Note it doesn't matter if we pass 'v.TopValDeclaringEntity' or 'v.MemberApparentEntity' here. // These only differ if the value is an extension member, and in that case MemberIsCompiledAsInstance always returns // false anyway - MemberIsCompiledAsInstance g v.MemberApparentParent v.IsExtensionMember membInfo v.Attribs + MemberIsCompiledAsInstance g v.MemberApparentEntity v.IsExtensionMember membInfo v.Attribs | _ -> false let ValRefIsCompiledAsInstanceMember g (vref: ValRef) = ValSpecIsCompiledAsInstance g vref.Deref @@ -7357,7 +7383,7 @@ let ValRefIsCompiledAsInstanceMember g (vref: ValRef) = ValSpecIsCompiledAsInsta let GetMemberCallInfo g (vref:ValRef, vFlags) = match vref.MemberInfo with | Some(membInfo) when not vref.IsExtensionMember -> - let numEnclTypeArgs = vref.MemberApparentParent.TyparsNoRange.Length + let numEnclTypeArgs = vref.MemberApparentEntity.TyparsNoRange.Length let virtualCall = (membInfo.MemberFlags.IsOverrideOrExplicitImpl || membInfo.MemberFlags.IsDispatchSlot) && diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 04410eae1c..467be96cdd 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -224,16 +224,36 @@ val mkArrayElemAddress : TcGlobals -> ILReadonly * bool * ILArrayShape * TType * // Compiled view of tuples //------------------------------------------------------------------------- +/// The largest tuple before we start encoding, i.e. 7 val maxTuple : int + +/// The number of fields in the largest tuple before we start encoding, i.e. 7 val goodTupleFields : int + +/// Check if a TyconRef is for a .NET tuple type. Currently this includes Tuple`1 even though +/// that' not really part of the target set of TyconRef used to represent F# tuples. val isCompiledTupleTyconRef : TcGlobals -> TyconRef -> bool + +/// Get a TyconRef for a .NET tuple type val mkCompiledTupleTyconRef : TcGlobals -> bool -> int -> TyconRef + +/// Convert from F# tuple types to .NET tuple types. val mkCompiledTupleTy : TcGlobals -> bool -> TTypes -> TType + +/// Convert from F# tuple creation expression to .NET tuple creation expressions val mkCompiledTuple : TcGlobals -> bool -> TTypes * Exprs * range -> TyconRef * TTypes * Exprs * range + +/// Make a TAST expression representing getting an item fromm a tuple val mkGetTupleItemN : TcGlobals -> range -> int -> ILType -> bool -> Expr -> TType -> Expr +/// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple +/// but TupInfo may later be used carry variables that infer structness. val evalTupInfoIsStruct : TupInfo -> bool +/// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged +val helpEnsureTypeHasMetadata : TcGlobals -> TType -> TType + + //------------------------------------------------------------------------- // Take the address of an expression, or force it into a mutable local. Any allocated // mutable local may need to be kept alive over a larger expression, hence we return diff --git a/src/fsharp/TastPickle.fs b/src/fsharp/TastPickle.fs index 18307ce155..3eb3ea37a4 100755 --- a/src/fsharp/TastPickle.fs +++ b/src/fsharp/TastPickle.fs @@ -948,13 +948,13 @@ and u_ILCallSig = u_wrap (fun (a,b,c) -> {CallingConv=a; ArgTypes=b; ReturnType= and u_ILTypeSpec st = let a,b = u_tup2 u_ILTypeRef u_ILTypes st in ILTypeSpec.Create(a,b) -let p_ILMethodRef (x: ILMethodRef) st = p_tup6 p_ILTypeRef p_ILCallConv p_int p_string p_ILTypes p_ILType (x.EnclosingTypeRef,x.CallingConv,x.GenericArity,x.Name,x.ArgTypes,x.ReturnType) st +let p_ILMethodRef (x: ILMethodRef) st = p_tup6 p_ILTypeRef p_ILCallConv p_int p_string p_ILTypes p_ILType (x.DeclaringTypeRef,x.CallingConv,x.GenericArity,x.Name,x.ArgTypes,x.ReturnType) st -let p_ILFieldRef (x: ILFieldRef) st = p_tup3 p_ILTypeRef p_string p_ILType (x.EnclosingTypeRef, x.Name, x.Type) st +let p_ILFieldRef (x: ILFieldRef) st = p_tup3 p_ILTypeRef p_string p_ILType (x.DeclaringTypeRef, x.Name, x.Type) st -let p_ILMethodSpec (x: ILMethodSpec) st = p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.EnclosingType, x.GenericArgs) st +let p_ILMethodSpec (x: ILMethodSpec) st = p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.DeclaringType, x.GenericArgs) st -let p_ILFieldSpec (x : ILFieldSpec) st = p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.EnclosingType) st +let p_ILFieldSpec (x : ILFieldSpec) st = p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.DeclaringType) st let p_ILBasicType x st = p_int (match x with @@ -982,7 +982,7 @@ let u_ILMethodRef st = let u_ILFieldRef st = let x1,x2,x3 = u_tup3 u_ILTypeRef u_string u_ILType st - {EnclosingTypeRef=x1;Name=x2;Type=x3} + {DeclaringTypeRef=x1;Name=x2;Type=x3} let u_ILMethodSpec st = let x1,x2,x3 = u_tup3 u_ILMethodRef u_ILType u_ILTypes st @@ -990,7 +990,7 @@ let u_ILMethodSpec st = let u_ILFieldSpec st = let x1,x2 = u_tup2 u_ILFieldRef u_ILType st - {FieldRef=x1;EnclosingType=x2} + {FieldRef=x1;DeclaringType=x2} let u_ILBasicType st = match u_int st with @@ -1778,7 +1778,7 @@ and p_attrib_arg (AttribNamedArg(a,b,c,d)) st = and p_member_info (x:ValMemberInfo) st = p_tup4 (p_tcref "member_info") p_MemberFlags (p_list p_slotsig) p_bool - (x.ApparentParent,x.MemberFlags,x.ImplementedSlotSigs,x.IsImplemented) st + (x.ApparentEnclosingEntity,x.MemberFlags,x.ImplementedSlotSigs,x.IsImplemented) st and p_tycon_objmodel_kind x st = match x with @@ -1822,7 +1822,7 @@ and p_ValData x st = p_option p_ValReprInfo x.val_repr_info st p_string x.val_xmldocsig st p_access x.val_access st - p_parentref x.val_actual_parent st + p_parentref x.val_declaring_entity st p_option p_const x.val_const st if st.oInMem then p_used_space1 (p_xmldoc x.val_xmldoc) st @@ -2063,7 +2063,7 @@ and u_attrib_arg st = and u_member_info st : ValMemberInfo = let x2,x3,x4,x5 = u_tup4 u_tcref u_MemberFlags (u_list u_slotsig) u_bool st - { ApparentParent=x2 + { ApparentEnclosingEntity=x2 MemberFlags=x3 ImplementedSlotSigs=x4 IsImplemented=x5 } @@ -2134,7 +2134,7 @@ and u_ValData st = val_xmldoc= defaultArg x15 XmlDoc.Empty val_xmldocsig=x12 val_access=x13 - val_actual_parent=x13b + val_declaring_entity=x13b val_const=x14 } diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index d2052200f9..73434eb100 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -463,17 +463,29 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d yield nleref.LastItemMangledName, ERefNonLocal nleref ] - let decodeTupleTy tupInfo l = + let tryDecodeTupleTy tupInfo l = match l with | [t1;t2;t3;t4;t5;t6;t7;marker] -> match marker with - | TType_app(tcref, [t8]) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] - | TType_app(tcref, [t8]) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] - | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus) - | _ -> TType_tuple (tupInfo, l) - | _ -> TType_tuple (tupInfo, l) + | TType_app(tcref, [t8]) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some + | TType_app(tcref, [t8]) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some + | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus) |> Some + | _ -> None + | [] -> None + | [_] -> None + | _ -> TType_tuple (tupInfo, l) |> Some + let decodeTupleTy tupInfo l = + match tryDecodeTupleTy tupInfo l with + | Some ty -> ty + | None -> failwith "couldn't decode tuple ty" + + let decodeTupleTyIfPossible tcref tupInfo l = + match tryDecodeTupleTy tupInfo l with + | Some ty -> ty + | None -> TType_app(tcref, l) + let mk_MFCore_attrib nm : BuiltinAttribInfo = AttribInfo(mkILTyRef(IlxSettings.ilxFsharpCoreLibScopeRef (), FSharpLib.Core + "." + nm), mk_MFCore_tcref fslibCcu nm) @@ -673,7 +685,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let addFieldNeverAttrs (fdef:ILFieldDef) = {fdef with CustomAttrs = addNeverAttrs fdef.CustomAttrs} let mkDebuggerTypeProxyAttribute (ty : ILType) = mkILCustomAttribute ilg (findSysILTypeRef tname_DebuggerTypeProxyAttribute, [ilg.typ_Type], [ILAttribElem.TypeRef (Some ty.TypeRef)], []) - let entries1 = + let betterTyconEntries = [| "Int32" , v_int_tcr "IntPtr" , v_nativeint_tcr "UIntPtr" , v_unativeint_tcr @@ -696,7 +708,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let ty = mkNonGenericTy tcr nm, findSysTyconRef sys nm, (fun _ -> ty)) - let entries2 = + let decompileTyconEntries = [| "FSharpFunc`2" , v_fastFunc_tcr , (fun tinst -> mkFunTy (List.item 0 tinst) (List.item 1 tinst)) "Tuple`2" , v_ref_tuple2_tcr , decodeTupleTy tupInfoRef @@ -705,62 +717,90 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d "Tuple`5" , v_ref_tuple5_tcr , decodeTupleTy tupInfoRef "Tuple`6" , v_ref_tuple6_tcr , decodeTupleTy tupInfoRef "Tuple`7" , v_ref_tuple7_tcr , decodeTupleTy tupInfoRef - "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTy tupInfoRef + "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyIfPossible v_ref_tuple8_tcr tupInfoRef "ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTy tupInfoStruct "ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTy tupInfoStruct "ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTy tupInfoStruct "ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTy tupInfoStruct "ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTy tupInfoStruct "ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTy tupInfoStruct |] - - // Build a map that uses the "canonical" F# type names and TyconRef's for these - // in preference to the .NET type names. Doing this normalization is a fairly performance critical - // piece of code as it is frequently invoked in the process of converting .NET metadata to F# internal - // compiler data structures (see import.fs). - let buildTyconMapper (entries: (string * TyconRef * _)[]) = + "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyIfPossible v_struct_tuple8_tcr tupInfoStruct |] + + let betterEntries = Array.append betterTyconEntries decompileTyconEntries + + let mutable decompileTypeDict = null + let mutable betterTypeDict1 = null + let mutable betterTypeDict2 = null + + /// This map is indexed by stamps and lazy to avoid dereferencing while setting up the base imports. + let getDecompileTypeDict () = + match decompileTypeDict with + | null -> + let entries = decompileTyconEntries + let t = Dictionary.newWithSize entries.Length + for _, tcref, builder in entries do + if tcref.CanDeref then + t.Add(tcref.Stamp, builder) + decompileTypeDict <- t + t + | t -> t + + /// This map is for use when building FSharp.Core.dll. The backing Tycon's may not yet exist for + /// the TyconRef's we have in our hands, hence we can't dereference them to find their stamps. + /// So this dictionary is indexed by names. Make it lazy to avoid dereferencing while setting up the base imports. + let getBetterTypeDict1 () = + match betterTypeDict1 with + | null -> + let entries = betterEntries + let t = Dictionary.newWithSize entries.Length + for nm, tcref, builder in entries do + t.Add(nm, fun tcref2 tinst2 -> if tyconRefEq tcref tcref2 then builder tinst2 else TType_app (tcref2, tinst2)) + betterTypeDict1 <- t + t + | t -> t + + /// This map is for use in normal times (not building FSharp.Core.dll). It is indexed by stamps + /// and lazy to avoid dereferencing while setting up the base imports. + let getBetterTypeDict2 () = + match betterTypeDict2 with + | null -> + let entries = betterEntries + let t = Dictionary.newWithSize entries.Length + for _, tcref, builder in entries do + if tcref.CanDeref then + t.Add(tcref.Stamp, builder) + betterTypeDict2 <- t + t + | t -> t + + /// For logical purposes equate some F# types with .NET types, e.g. TType_tuple == System.Tuple/ValueTuple. + /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked + /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). + let decompileTy (tcref: EntityRef) tinst = + if compilingFslib then + // No need to decompile when compiling FSharp.Core.dll + TType_app (tcref, tinst) + else + let dict = getDecompileTypeDict() + let mutable builder = Unchecked.defaultof<_> + if dict.TryGetValue(tcref.Stamp, &builder) then builder tinst + else TType_app (tcref, tinst) + + /// For cosmetic purposes "improve" some .NET types, e.g. Int32 --> int32. + /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked + /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). + let improveTy (tcref: EntityRef) tinst = if compilingFslib then - // This map is for use when building FSharp.Core.dll. The backing Tycon's may not yet exist for - // the TyconRef's we have in our hands, hence we can't dereference them to find their stamps. - - // So this dictionary is indexed by names. - // - // Make it lazy to avoid dereferencing while setting up the base imports. - let dict = - lazy ( - let dict = Dictionary.newWithSize entries.Length - for nm, tcref, builder in entries do - dict.Add(nm, fun tcref2 tinst -> if tyconRefEq tcref tcref2 then Some(builder tinst) else None) - dict - ) - (fun (tcref: EntityRef) tinst -> - let dict = dict.Value - let key = tcref.LogicalName - if dict.ContainsKey key then dict.[key] tcref tinst - else None ) + let dict = getBetterTypeDict1() + let mutable builder = Unchecked.defaultof<_> + if dict.TryGetValue(tcref.LogicalName, &builder) then builder tcref tinst + else TType_app (tcref, tinst) else - // This map is for use in normal times (not building FSharp.Core.dll). It is indexed by tcref stamp which is - // faster than the indexing technique used in the case above. - // - // So this dictionary is indexed by integers. - // - // Make it lazy to avoid dereferencing while setting up the base imports. - let dict = - lazy - let dict = Dictionary.newWithSize entries.Length - for _, tcref, builder in entries do - if tcref.CanDeref then - dict.Add(tcref.Stamp, builder) - dict - (fun tcref2 tinst -> - let dict = dict.Value - let key = tcref2.Stamp - if dict.ContainsKey key then Some(dict.[key] tinst) - else None) - - let betterTyconRefMapper = buildTyconMapper (Array.append entries1 entries2) - - let decodeTyconRefMapper = buildTyconMapper entries2 + let dict = getBetterTypeDict2() + let mutable builder = Unchecked.defaultof<_> + if dict.TryGetValue(tcref.Stamp, &builder) then builder tinst + else TType_app (tcref, tinst) + override x.ToString() = "" member __.ilg=ilg @@ -1051,8 +1091,10 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val attrib_SecuritySafeCriticalAttribute = findSysAttrib "System.Security.SecuritySafeCriticalAttribute" member val attrib_ComponentModelEditorBrowsableAttribute = findSysAttrib "System.ComponentModel.EditorBrowsableAttribute" - member __.betterTyconRefMap = betterTyconRefMapper - member __.decodeTyconRefMap = decodeTyconRefMapper + member g.improveType tcref tinst = improveTy tcref tinst + + member g.decompileType tcref tinst = decompileTy tcref tinst + member __.new_decimal_info = v_new_decimal_info member __.seq_info = v_seq_info member val seq_vref = (ValRefForIntrinsic v_seq_info) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 061acc58c7..fda1dbda1a 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -173,6 +173,10 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo:MethInfo) = if not (IsTypeAndMethInfoAccessible amap m adOriginal ad minfo) then error (Error (FSComp.SR.tcMethodNotAccessible(minfo.LogicalName), m)) + + if isAnyTupleTy g minfo.ApparentEnclosingType then + warning (Error (FSComp.SR.tcTupleMemberNotNormallyUsed(), m)) + CheckMethInfoAttributes g m tyargsOpt minfo |> CommitOperationResult @@ -640,7 +644,7 @@ let MakeInnerEnvForTyconRef _cenv env tcref isExtrinsicExtension = let MakeInnerEnvForMember cenv env (v:Val) = match v.MemberInfo with | None -> env - | Some _ -> MakeInnerEnvForTyconRef cenv env v.MemberApparentParent v.IsExtensionMember + | Some _ -> MakeInnerEnvForTyconRef cenv env v.MemberApparentEntity v.IsExtensionMember let GetCurrAccumulatedModuleOrNamespaceType env = !(env.eModuleOrNamespaceTypeAccumulator) let SetCurrAccumulatedModuleOrNamespaceType env x = env.eModuleOrNamespaceTypeAccumulator := x @@ -797,7 +801,7 @@ let ReportImplicitlyIgnoredBoolExpression denv m ty expr = if propRef.IsPropertyGetterMethod then let propertyName = propRef.PropertyName let hasCorrespondingSetter = - match propRef.ActualParent with + match propRef.DeclaringEntity with | Parent entityRef -> entityRef.MembersOfFSharpTyconSorted |> List.exists (fun valRef -> valRef.IsPropertySetterMethod && valRef.PropertyName = propertyName) @@ -1042,7 +1046,7 @@ let MakeMemberDataAndMangledNameForMemberVal(g, tcref, isExtrinsic, attrs, optIm let logicalName = ComputeLogicalName id memberFlags let optIntfSlotTys = if optImplSlotTys |> List.forall (isInterfaceTy g) then optImplSlotTys else [] let memberInfo : ValMemberInfo = - { ApparentParent=tcref + { ApparentEnclosingEntity=tcref MemberFlags=memberFlags IsImplemented=false // NOTE: This value is initially only set for interface implementations and those overrides @@ -1345,7 +1349,7 @@ let PublishValueDefn cenv env declKind (vspec:Val) = // // Static initializers don't get published to the tcaug // not (memberInfo.MemberFlags.MemberKind = MemberKind.ClassConstructor)) -> - let tcaug = vspec.MemberApparentParent.TypeContents + let tcaug = vspec.MemberApparentEntity.TypeContents let vref = mkLocalValRef vspec tcaug.tcaug_adhoc <- NameMultiMap.add vspec.LogicalName vref tcaug.tcaug_adhoc tcaug.tcaug_adhoc_list.Add (ValRefIsExplicitImpl cenv.g vref, vref) @@ -1430,7 +1434,7 @@ let MakeAndPublishVal cenv env (altActualParent, inSig, declKind, vrec, (ValSche // If it's an extrinsic extension member or not a member then use the containing module. match memberInfoOpt with | Some (ValMemberInfoTransient(memberInfo, _, _)) when not isExtrinsic -> - if memberInfo.ApparentParent.IsModuleOrNamespace then + if memberInfo.ApparentEnclosingEntity.IsModuleOrNamespace then errorR(InternalError(FSComp.SR.tcExpectModuleOrNamespaceParent(id.idText), m)) // Members of interface implementations have the accessibility of the interface @@ -1443,7 +1447,7 @@ let MakeAndPublishVal cenv env (altActualParent, inSig, declKind, vrec, (ValSche | _ -> None else None - Parent(memberInfo.ApparentParent), vis + Parent(memberInfo.ApparentEnclosingEntity), vis | _ -> altActualParent, None let vis, _ = ComputeAccessAndCompPath env (Some declKind) id.idRange vis overrideVis actualParent @@ -1951,7 +1955,7 @@ let FreshenAbstractSlot g amap m synTyparDecls absMethInfo = // If the virtual method is a generic method then copy its type parameters let typarsFromAbsSlot, typarInstFromAbsSlot, _ = let ttps = absMethInfo.GetFormalTyparsOfDeclaringType m - let ttinst = argsOfAppTy g absMethInfo.EnclosingType + let ttinst = argsOfAppTy g absMethInfo.ApparentEnclosingType let rigid = if typarsFromAbsSlotAreRigid then TyparRigidity.Rigid else TyparRigidity.Flexible ConstraintSolver.FreshenAndFixupTypars m rigid ttps ttinst fmtps @@ -3090,7 +3094,7 @@ let BuildILFieldGet g amap m objExpr (finfo:ILFieldInfo) = // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. * - let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef []) + let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef []) // Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr. wrap (mkAsmExpr (([ mkNormalLdfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else [])), tinst, [objExpr], [fieldType], m)) @@ -3102,7 +3106,7 @@ let BuildILFieldSet g m objExpr (finfo:ILFieldInfo) argExpr = // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. * - let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef []) + let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef []) if finfo.IsInitOnly then error (Error (FSComp.SR.tcFieldIsReadonly(), m)) let wrap, objExpr = mkExprAddrOfExpr g isValueType false DefinitelyMutates objExpr None m wrap (mkAsmExpr ([ mkNormalStfld fspec ], tinst, [objExpr; argExpr], [], m)) @@ -3115,12 +3119,12 @@ let BuildILStaticFieldSet m (finfo:ILFieldInfo) argExpr = // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. - let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef []) + let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef []) if finfo.IsInitOnly then error (Error (FSComp.SR.tcFieldIsReadonly(), m)) mkAsmExpr ([ mkNormalStsfld fspec ], tinst, [argExpr], [], m) let BuildRecdFieldSet g m objExpr (rfinfo:RecdFieldInfo) argExpr = - let tgty = rfinfo.EnclosingType + let tgty = rfinfo.DeclaringType let valu = isStructTy g tgty let objExpr = if valu then objExpr else mkCoerceExpr(objExpr, tgty, m, tyOfExpr g objExpr) let wrap, objExpr = mkExprAddrOfExpr g valu false DefinitelyMutates objExpr None m @@ -4929,11 +4933,7 @@ and TcTypeApp cenv newOk checkCxs occ env tpenv m tcref pathTypeArgs (synArgTys: List.iter2 (UnifyTypes cenv env m) tinst actualArgTys // Try to decode System.Tuple --> F~ tuple types etc. - let ty = - let decode = if cenv.g.compilingFslib then None else cenv.g.decodeTyconRefMap tcref actualArgTys - match decode with - | Some res -> res - | None -> mkAppTy tcref actualArgTys + let ty = cenv.g.decompileType tcref actualArgTys ty, tpenv @@ -4954,6 +4954,7 @@ and TcTypeAndRecover cenv newOk checkCxs occ env tpenv ty = TcTypeOrMeasureAndRecover (Some TyparKind.Type) cenv newOk checkCxs occ env tpenv ty and TcNestedTypeApplication cenv newOk checkCxs occ env tpenv mWholeTypeApp typ tyargs = + let typ = helpEnsureTypeHasMetadata cenv.g typ if not (isAppTy cenv.g typ) then error(Error(FSComp.SR.tcTypeHasNoNestedTypes(), mWholeTypeApp)) match typ with | TType_app(tcref, tinst) -> @@ -6234,7 +6235,7 @@ and TcNewExpr cenv env tpenv objTy mObjTyOpt superInit arg mWholeExprOrObjTy = mkCallCreateInstance cenv.g mWholeExprOrObjTy objTy , tpenv else - if not (isAppTy cenv.g objTy) then error(Error(FSComp.SR.tcNamedTypeRequired(if superInit then "inherit" else "new"), mWholeExprOrObjTy)) + if not (isAppTy cenv.g objTy) && not (isAnyTupleTy cenv.g objTy) then error(Error(FSComp.SR.tcNamedTypeRequired(if superInit then "inherit" else "new"), mWholeExprOrObjTy)) let item = ForceRaise (ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mWholeExprOrObjTy ad objTy) TcCtorCall false cenv env tpenv objTy objTy mObjTyOpt item superInit [arg] mWholeExprOrObjTy [] None @@ -8658,7 +8659,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del | Item.CtorGroup(nm, minfos) -> let objTy = match minfos with - | (minfo :: _) -> minfo.EnclosingType + | (minfo :: _) -> minfo.ApparentEnclosingType | [] -> error(Error(FSComp.SR.tcTypeHasNoAccessibleConstructor(), mItem)) match delayed with | ((DelayedApp (_, arg, mExprAndArg))::otherDelayed) -> @@ -8684,7 +8685,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del #endif item, minfos - minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.EnclosingType objTyAfterTyArgs) + minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTyAfterTyArgs) TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mExprAndTypeArgs) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution) | ((DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs))::otherDelayed) -> @@ -8695,7 +8696,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del let resolvedItem = Item.Types(nm, [objTy]) CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, resolvedItem, emptyTyparInst, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights) - minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.EnclosingType objTy) + minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTy) TcCtorCall true cenv env tpenv overallTy objTy (Some mExprAndTypeArgs) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) | _ -> @@ -8934,7 +8935,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del // The empty instantiation on the fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. - let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef []) + let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef []) // Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr. mkAsmExpr ([ mkNormalLdsfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else []), finfo.TypeInst, [], [exprty], mItem) @@ -9084,7 +9085,7 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela | Item.RecdField rfinfo -> // Get or set instance F# field or literal RecdFieldInstanceChecks cenv.g cenv.amap ad mItem rfinfo - let tgty = rfinfo.EnclosingType + let tgty = rfinfo.DeclaringType let valu = isStructTy cenv.g tgty AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css mItem NoTrace tgty objExprTy let objExpr = if valu then objExpr else mkCoerceExpr(objExpr, tgty, mExprAndItem, objExprTy) @@ -9160,10 +9161,10 @@ and TcEventValueThen cenv overallTy env tpenv mItem mExprAndItem objDetails (ein // EventHelper ((fun d -> e.add_X(d)), (fun d -> e.remove_X(d)), (fun f -> new 'Delegate(f))) mkCallCreateEvent cenv.g mItem delegateType argsTy (let dv, de = mkCompGenLocal mItem "eventDelegate" delegateType - let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false (einfo.GetAddMethod()) NormalValUse [] objVars [de] + let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.AddMethod NormalValUse [] objVars [de] mkLambda mItem dv (callExpr, cenv.g.unit_ty)) (let dv, de = mkCompGenLocal mItem "eventDelegate" delegateType - let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false (einfo.GetRemoveMethod()) NormalValUse [] objVars [de] + let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.RemoveMethod NormalValUse [] objVars [de] mkLambda mItem dv (callExpr, cenv.g.unit_ty)) (let fvty = (cenv.g.obj_ty --> (argsTy --> cenv.g.unit_ty)) let fv, fe = mkCompGenLocal mItem "callback" fvty @@ -9629,20 +9630,20 @@ and TcMethodApplication // if (isInstance && finalCalledMethInfo.IsInstance && - typeEquiv cenv.g finalCalledMethInfo.EnclosingType cenv.g.obj_ty && + typeEquiv cenv.g finalCalledMethInfo.ApparentEnclosingType cenv.g.obj_ty && (finalCalledMethInfo.LogicalName = "GetHashCode" || finalCalledMethInfo.LogicalName = "Equals")) then objArgs |> List.iter (fun expr -> ConstraintSolver.AddCxTypeMustSupportEquality env.DisplayEnv cenv.css mMethExpr NoTrace (tyOfExpr cenv.g expr)) // Uses of a Dictionary() constructor without an IEqualityComparer argument imply an equality constraint // on the first type argument. - if HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary finalCalledMethInfo.EnclosingType && + if HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary finalCalledMethInfo.ApparentEnclosingType && finalCalledMethInfo.IsConstructor && not (finalCalledMethInfo.GetParamDatas(cenv.amap, mItem, finalCalledMeth.CalledTyArgs) |> List.existsSquared (fun (ParamData(_, _, _, _, _, _, ty)) -> HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IEqualityComparer ty)) then - match argsOfAppTy cenv.g finalCalledMethInfo.EnclosingType with + match argsOfAppTy cenv.g finalCalledMethInfo.ApparentEnclosingType with | [dty; _] -> ConstraintSolver.AddCxTypeMustSupportEquality env.DisplayEnv cenv.css mMethExpr NoTrace dty | _ -> () end @@ -10195,7 +10196,7 @@ and TcAndBuildFixedExpr cenv env (overallPatTy, fixedExpr, overallExprTy, mBindi | Expr.Op (op, tyargs, args, _) -> match op, tyargs, args with | TOp.ValFieldGetAddr rfref, _, [_] -> not rfref.Tycon.IsStructOrEnumTycon - | TOp.ILAsm ([ I_ldflda (fspec)], _), _, _ -> fspec.EnclosingType.Boxity = ILBoxity.AsObject + | TOp.ILAsm ([ I_ldflda (fspec)], _), _, _ -> fspec.DeclaringType.Boxity = ILBoxity.AsObject | TOp.ILAsm ([ I_ldelema _], _), _, _ -> true | TOp.RefAddrGet _, _, _ -> true | _ -> false @@ -10762,7 +10763,7 @@ and TcLetBinding cenv isUse env containerInfo declKind tpenv (binds, bindsm, sco // This assignment forces representation as module value, to maintain the invariant from the // type checker that anything related to binding module-level values is marked with an - // val_repr_info, val_actual_parent and is_topbind + // val_repr_info, val_declaring_entity and is_topbind if (DeclKind.MustHaveArity declKind) then AdjustValToTopVal tmp altActualParent (InferArityOfExprBinding cenv.g AllowTypeDirectedDetupling.Yes tmp rhsExpr) tmp, pat' @@ -10931,7 +10932,7 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy let optInferredImplSlotTys = match optIntfSlotTy with | Some (x, _) -> [x] - | None -> uniqueAbstractMethSigs |> List.map (fun x -> x.EnclosingType) + | None -> uniqueAbstractMethSigs |> List.map (fun x -> x.ApparentEnclosingType) optInferredImplSlotTys, declaredTypars @@ -10993,7 +10994,7 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy let optInferredImplSlotTys = match optIntfSlotTy with | Some (x, _) -> [ x ] - | None -> uniqueAbstractPropSigs |> List.map (fun pinfo -> pinfo.EnclosingType) + | None -> uniqueAbstractPropSigs |> List.map (fun pinfo -> pinfo.ApparentEnclosingType) optInferredImplSlotTys, declaredTypars @@ -14307,7 +14308,7 @@ module TcExceptionDeclarations = minfo.GenericArity = 0) match candidates with | [minfo] -> - match minfo.EnclosingType with + match minfo.ApparentEnclosingType with | AppTy cenv.g (tcref, _) as ety when (TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m cenv.g.exn_ty ety) -> let tref = tcref.CompiledRepresentationForNamedType TExnAsmRepr tref diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index b1ec3cfca0..f6d7b4c6b8 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1091,7 +1091,7 @@ module StaticLinker = match depILModule.Manifest with | Some m -> for ca in m.CustomAttrs.AsList do - if ca.Method.MethodRef.EnclosingTypeRef.FullName = typeof.FullName then + if ca.Method.MethodRef.DeclaringTypeRef.FullName = typeof.FullName then yield ca | _ -> () ] @@ -1201,7 +1201,7 @@ module StaticLinker = |> List.map (fun md -> {md with CustomAttrs = mkILCustomAttrs (td.CustomAttrs.AsList |> List.filter (fun ilattr -> - ilattr.Method.EnclosingType.TypeRef.FullName <> "System.Runtime.TargetedPatchingOptOutAttribute") )}) + ilattr.Method.DeclaringType.TypeRef.FullName <> "System.Runtime.TargetedPatchingOptOutAttribute") )}) |> mkILMethods } ])} //ILAsciiWriter.output_module stdout fakeModule fakeModule.TypeDefs.AsList diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs index 6db631a031..f6f5648d8e 100644 --- a/src/fsharp/import.fs +++ b/src/fsharp/import.fs @@ -150,9 +150,7 @@ let CanImportILTypeRef (env:ImportMap) m (tref:ILTypeRef) = /// Prefer the F# abbreviation for some built-in types, e.g. 'string' rather than /// 'System.String', since we prefer the F# abbreviation to the .NET equivalents. let ImportTyconRefApp (env:ImportMap) tcref tyargs = - match env.g.betterTyconRefMap tcref tyargs with - | Some res -> res - | None -> TType_app (tcref,tyargs) + env.g.improveType tcref tyargs /// Import an IL type as an F# type. let rec ImportILType (env:ImportMap) m tinst typ = diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index 07ab90f403..1a636574fe 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -410,7 +410,7 @@ let GetCompiledReturnTyOfProvidedMethodInfo amap m (mi:Tainted - let parentToMemberInst,_ = mkTyparToTyparRenaming (ovByMethValRef.MemberApparentParent.Typars(m)) enclosingTypars + let parentToMemberInst,_ = mkTyparToTyparRenaming (ovByMethValRef.MemberApparentEntity.Typars(m)) enclosingTypars let res = instSlotSig parentToMemberInst slotsig res | None -> @@ -659,30 +659,50 @@ let ArbitraryMethodInfoOfPropertyInfo (pi:Tainted) m = [] type ILTypeInfo = /// ILTypeInfo (tyconRef, ilTypeRef, typeArgs, ilTypeDef). - | ILTypeInfo of TyconRef * ILTypeRef * TypeInst * ILTypeDef + | ILTypeInfo of TcGlobals * TType * ILTypeRef * ILTypeDef + + member x.TcGlobals = let (ILTypeInfo(g,_,_,_)) = x in g + + member x.ILTypeRef = let (ILTypeInfo(_,_,tref,_)) = x in tref - member x.TyconRef = let (ILTypeInfo(tcref,_,_,_)) = x in tcref - member x.ILTypeRef = let (ILTypeInfo(_,tref,_,_)) = x in tref - member x.TypeInst = let (ILTypeInfo(_,_,tinst,_)) = x in tinst member x.RawMetadata = let (ILTypeInfo(_,_,_,tdef)) = x in tdef - member x.ToType = TType_app(x.TyconRef,x.TypeInst) + + member x.ToType = let (ILTypeInfo(_,ty,_,_)) = x in ty + + /// Get the compiled nominal type. In the case of tuple types, this is a .NET tuple type + member x.ToAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ToType + + member x.TyconRefOfRawMetadata = tcrefOfAppTy x.TcGlobals x.ToAppType + + member x.TypeInstOfRawMetadata = argsOfAppTy x.TcGlobals x.ToAppType + member x.ILScopeRef = x.ILTypeRef.Scope + member x.Name = x.ILTypeRef.Name + member x.IsValueType = x.RawMetadata.IsStructOrEnum - member x.Instantiate inst = - let (ILTypeInfo(tcref,tref,tinst,tdef)) = x - ILTypeInfo(tcref,tref,instTypes inst tinst,tdef) - member x.FormalTypars m = x.TyconRef.Typars m + member x.Instantiate inst = + let (ILTypeInfo(g,ty,tref,tdef)) = x + ILTypeInfo(g,instType inst ty,tref,tdef) static member FromType g ty = - if isILAppTy g ty then - let tcref,tinst = destAppTy g ty - let (TILObjectReprData(scoref,enc,tdef)) = tcref.ILTyconInfo + if isAnyTupleTy g ty then + // When getting .NET metadata for the properties and methods + // of an F# tuple type, use the compiled nominal type, which is a .NET tuple type + let metadataTy = helpEnsureTypeHasMetadata g ty + assert (isILAppTy g metadataTy) + let metadataTyconRef = tcrefOfAppTy g metadataTy + let (TILObjectReprData(scoref, enc, tdef)) = metadataTyconRef.ILTyconInfo + let metadataILTypeRef = mkRefForNestedILTypeDef scoref (enc,tdef) + ILTypeInfo(g, ty, metadataILTypeRef, tdef) + elif isILAppTy g ty then + let tcref = tcrefOfAppTy g ty + let (TILObjectReprData(scoref, enc, tdef)) = tcref.ILTyconInfo let tref = mkRefForNestedILTypeDef scoref (enc,tdef) - ILTypeInfo(tcref,tref,tinst,tdef) + ILTypeInfo(g, ty, tref, tdef) else - failwith "ILTypeInfo.FromType" + failwith "ILTypeInfo.FromType - no IL metadata for type" //------------------------------------------------------------------------- // ILMethInfo @@ -702,12 +722,15 @@ type ILMethInfo = member x.TcGlobals = match x with ILMethInfo(g,_,_,_,_) -> g /// Get the apparent declaring type of the method as an F# type. - /// If this is an C#-style extension method then this is the type which the method + /// If this is a C#-style extension method then this is the type which the method /// appears to extend. This may be a variable type. member x.ApparentEnclosingType = match x with ILMethInfo(_,ty,_,_,_) -> ty + /// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type + member x.ApparentEnclosingAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType + /// Get the declaring type associated with an extension member, if any. - member x.DeclaringTyconRefOption = match x with ILMethInfo(_,_,tcrefOpt,_,_) -> tcrefOpt + member x.ILExtensionMethodDeclaringTyconRef = match x with ILMethInfo(_,_,tcrefOpt,_,_) -> tcrefOpt /// Get the Abstract IL metadata associated with the method. member x.RawMetadata = match x with ILMethInfo(_,_,_,md,_) -> md @@ -719,20 +742,21 @@ type ILMethInfo = member x.ILName = x.RawMetadata.Name /// Indicates if the method is an extension method - member x.IsILExtensionMethod = x.DeclaringTyconRefOption.IsSome + member x.IsILExtensionMethod = x.ILExtensionMethodDeclaringTyconRef.IsSome /// Get the declaring type of the method. If this is an C#-style extension method then this is the IL type /// holding the static member that is the extension method. member x.DeclaringTyconRef = - match x.DeclaringTyconRefOption with + match x.ILExtensionMethodDeclaringTyconRef with | Some tcref -> tcref - | None -> tcrefOfAppTy x.TcGlobals x.ApparentEnclosingType + | None -> tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType /// Get the instantiation of the declaring type of the method. /// If this is an C#-style extension method then this is empty because extension members /// are never in generic classes. member x.DeclaringTypeInst = - if x.IsILExtensionMethod then [] else argsOfAppTy x.TcGlobals x.ApparentEnclosingType + if x.IsILExtensionMethod then [] + else argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType /// Get the Abstract IL scope information associated with interpreting the Abstract IL metadata that backs this method. member x.MetadataScope = x.DeclaringTyconRef.CompiledRepresentationForNamedType.Scope @@ -845,7 +869,7 @@ type ILMethInfo = /// Describes an F# use of a method [] type MethInfo = - /// FSMeth(tcGlobals, declaringType, valRef, extensionMethodPriority). + /// FSMeth(tcGlobals, enclosingType, valRef, extensionMethodPriority). /// /// Describes a use of a method declared in F# code and backed by F# metadata. | FSMeth of TcGlobals * TType * ValRef * ExtensionMethodPriority option @@ -867,24 +891,33 @@ type MethInfo = /// /// If this is an extension member, then this is the apparent parent, i.e. the type the method appears to extend. /// This may be a variable type. - member x.EnclosingType = + member x.ApparentEnclosingType = match x with - | ILMeth(_g,ilminfo,_) -> ilminfo.ApparentEnclosingType - | FSMeth(_g,typ,_,_) -> typ - | DefaultStructCtor(_g,typ) -> typ + | ILMeth(_,ilminfo,_) -> ilminfo.ApparentEnclosingType + | FSMeth(_,typ,_,_) -> typ + | DefaultStructCtor(_,typ) -> typ #if !NO_EXTENSIONTYPING | ProvidedMeth(amap,mi,_,m) -> Import.ImportProvidedType amap m (mi.PApply((fun mi -> mi.DeclaringType),m)) #endif + /// Get the enclosing type of the method info, using a nominal type for tuple types + member x.ApparentEnclosingAppType = + match x with + | ILMeth(_,ilminfo,_) -> ilminfo.ApparentEnclosingAppType + | _ -> x.ApparentEnclosingType + + member x.ApparentEnclosingTyconRef = + tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType + /// Get the declaring type or module holding the method. If this is an C#-style extension method then this is the type /// holding the static member that is the extension method. If this is an F#-style extension method it is the logical module /// holding the value for the extension method. - member x.DeclaringEntityRef = + member x.DeclaringTyconRef = match x with | ILMeth(_,ilminfo,_) when x.IsExtensionMember -> ilminfo.DeclaringTyconRef - | FSMeth(_,_,vref,_) when x.IsExtensionMember && vref.HasTopValActualParent -> vref.TopValActualParent - | _ -> tcrefOfAppTy x.TcGlobals x.EnclosingType + | FSMeth(_,_,vref,_) when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity + | _ -> x.ApparentEnclosingTyconRef /// Get the information about provided static parameters, if any member x.ProvidedStaticParameterInfo = @@ -954,13 +987,13 @@ type MethInfo = #endif | _ -> false - override x.ToString() = x.EnclosingType.ToString() + x.LogicalName + override x.ToString() = x.ApparentEnclosingType.ToString() + x.LogicalName /// Get the actual type instantiation of the declaring type associated with this use of the method. /// /// For extension members this is empty (the instantiation of the declaring type). member x.DeclaringTypeInst = - if x.IsExtensionMember then [] else argsOfAppTy x.TcGlobals x.EnclosingType + if x.IsExtensionMember then [] else argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType /// Get the TcGlobals value that governs the method declaration member x.TcGlobals = @@ -1080,7 +1113,7 @@ type MethInfo = match x with | ILMeth(_g,ilmeth,_) -> ilmeth.IsVirtual | FSMeth(g,_,vref,_) as x -> - isInterfaceTy g x.EnclosingType || + isInterfaceTy g x.ApparentEnclosingType || vref.MemberInfo.Value.MemberFlags.IsDispatchSlot | DefaultStructCtor _ -> false #if !NO_EXTENSIONTYPING @@ -1107,14 +1140,14 @@ type MethInfo = member minfo.IsAbstract = match minfo with | ILMeth(_,ilmeth,_) -> ilmeth.IsAbstract - | FSMeth(g,_,vref,_) -> isInterfaceTy g minfo.EnclosingType || vref.IsDispatchSlotMember + | FSMeth(g,_,vref,_) -> isInterfaceTy g minfo.ApparentEnclosingType || vref.IsDispatchSlotMember | DefaultStructCtor _ -> false #if !NO_EXTENSIONTYPING | ProvidedMeth(_,mi,_,m) -> mi.PUntaint((fun mi -> mi.IsAbstract), m) #endif member x.IsNewSlot = - isInterfaceTy x.TcGlobals x.EnclosingType || + isInterfaceTy x.TcGlobals x.ApparentEnclosingType || (x.IsVirtual && (match x with | ILMeth(_,x,_) -> x.IsNewSlot @@ -1173,7 +1206,7 @@ type MethInfo = // but is compiled as a generic methods with two type arguments // Map<'T,'U>(this: List<'T>, f : 'T -> 'U) member x.AdjustUserTypeInstForFSharpStyleIndexedExtensionMembers(tyargs) = - (if x.IsFSharpStyleExtensionMember then argsOfAppTy x.TcGlobals x.EnclosingType else []) @ tyargs + (if x.IsFSharpStyleExtensionMember then argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType else []) @ tyargs /// Indicates if this method is a generated method associated with an F# CLIEvent property compiled as a .NET event member x.IsFSharpEventPropertyMethod = @@ -1191,13 +1224,13 @@ type MethInfo = /// /// For an extension method, this indicates if the method extends a struct type. member x.IsStruct = - isStructTy x.TcGlobals x.EnclosingType + isStructTy x.TcGlobals x.ApparentEnclosingType /// Build IL method infos. static member CreateILMeth (amap:Import.ImportMap, m, typ:TType, md: ILMethodDef) = let tinfo = ILTypeInfo.FromType amap.g typ - let mtps = Import.ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInst md.GenericParams - ILMeth (amap.g,ILMethInfo(amap.g,tinfo.ToType,None,md,mtps),None) + let mtps = Import.ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata md.GenericParams + ILMeth (amap.g,ILMethInfo(amap.g, typ, None, md, mtps),None) /// Build IL method infos for a C#-style extension method static member CreateILExtensionMeth (amap, m, apparentTy:TType, declaringTyconRef:TyconRef, extMethPri, md: ILMethodDef) = @@ -1211,7 +1244,7 @@ type MethInfo = match x1,x2 with | ILMeth(_,x1,_), ILMeth(_,x2,_) -> (x1.RawMetadata === x2.RawMetadata) | FSMeth(g,_,vref1,_), FSMeth(_,_,vref2,_) -> valRefEq g vref1 vref2 - | DefaultStructCtor(g,ty1), DefaultStructCtor(_,ty2) -> tyconRefEq g (tcrefOfAppTy g ty1) (tcrefOfAppTy g ty2) + | DefaultStructCtor _, DefaultStructCtor _ -> tyconRefEq x1.TcGlobals x1.DeclaringTyconRef x2.DeclaringTyconRef #if !NO_EXTENSIONTYPING | ProvidedMeth(_,mi1,_,_),ProvidedMeth(_,mi2,_,_) -> ProvidedMethodBase.TaintedEquals (mi1, mi2) #endif @@ -1423,7 +1456,7 @@ type MethInfo = // The FSMeth, ILMeth+ProvidedMeth paths can probably be unified too. member x.GetSlotSig(amap, m) = match x with - | FSMeth(g,typ,vref,_) -> + | FSMeth(g,_,vref,_) -> match vref.RecursiveValInfo with | ValInRecScope(false) -> error(Error((FSComp.SR.InvalidRecursiveReferenceToAbstractSlot()),m)) | _ -> () @@ -1431,14 +1464,14 @@ type MethInfo = let allTyparsFromMethod,_,retTy,_ = GetTypeOfMemberInMemberForm g vref // A slot signature is w.r.t. the type variables of the type it is associated with. // So we have to rename from the member type variables to the type variables of the type. - let formalEnclosingTypars = (tcrefOfAppTy g typ).Typars(m) + let formalEnclosingTypars = x.ApparentEnclosingTyconRef.Typars(m) let formalEnclosingTyparsFromMethod,formalMethTypars = List.chop formalEnclosingTypars.Length allTyparsFromMethod let methodToParentRenaming,_ = mkTyparToTyparRenaming formalEnclosingTyparsFromMethod formalEnclosingTypars let formalParams = GetArgInfosOfMember x.IsCSharpStyleExtensionMember g vref |> List.mapSquared (map1Of2 (instType methodToParentRenaming) >> MakeSlotParam ) let formalRetTy = Option.map (instType methodToParentRenaming) retTy - MakeSlotSig(x.LogicalName, x.EnclosingType, formalEnclosingTypars, formalMethTypars, formalParams, formalRetTy) + MakeSlotSig(x.LogicalName, x.ApparentEnclosingType, formalEnclosingTypars, formalMethTypars, formalParams, formalRetTy) | DefaultStructCtor _ -> error(InternalError("no slotsig for DefaultStructCtor",m)) | _ -> let g = x.TcGlobals @@ -1448,7 +1481,7 @@ type MethInfo = // happens to make the return type 'unit' (i.e. it was originally a variable type // then that does not correspond to a slotsig compiled as a 'void' return type. // REVIEW: should we copy down attributes to slot params? - let tcref = tcrefOfAppTy g x.EnclosingType + let tcref = tcrefOfAppTy g x.ApparentEnclosingAppType let formalEnclosingTyparsOrig = tcref.Typars(m) let formalEnclosingTypars = copyTypars formalEnclosingTyparsOrig let _,formalEnclosingTyparTys = FixupNewTypars m [] [] formalEnclosingTyparsOrig formalEnclosingTypars @@ -1458,10 +1491,10 @@ type MethInfo = match x with | ILMeth(_,ilminfo,_) -> let ftinfo = ILTypeInfo.FromType g (TType_app(tcref,formalEnclosingTyparTys)) - let formalRetTy = ImportReturnTypeFromMetaData amap m ilminfo.RawMetadata.Return.Type ftinfo.ILScopeRef ftinfo.TypeInst formalMethTyparTys + let formalRetTy = ImportReturnTypeFromMetaData amap m ilminfo.RawMetadata.Return.Type ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys let formalParams = [ [ for p in ilminfo.RawMetadata.Parameters do - let paramType = ImportILTypeFromMetadata amap m ftinfo.ILScopeRef ftinfo.TypeInst formalMethTyparTys p.Type + let paramType = ImportILTypeFromMetadata amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type yield TSlotParam(p.Name, paramType, p.IsIn, p.IsOut, p.IsOptional, []) ] ] formalRetTy, formalParams #if !NO_EXTENSIONTYPING @@ -1480,7 +1513,7 @@ type MethInfo = formalRetTy, formalParams #endif | _ -> failwith "unreachable" - MakeSlotSig(x.LogicalName, x.EnclosingType, formalEnclosingTypars, formalMethTypars,formalParams, formalRetTy) + MakeSlotSig(x.LogicalName, x.ApparentEnclosingType, formalEnclosingTypars, formalMethTypars,formalParams, formalRetTy) /// Get the ParamData objects for the parameters of a MethInfo member x.GetParamDatas(amap, m, minst) = @@ -1528,16 +1561,11 @@ type MethInfo = if x.IsExtensionMember then [] else match x with - | ILMeth(_,ilminfo,_) -> ilminfo.DeclaringTyconRef.Typars m | FSMeth(g,typ,vref,_) -> let memberParentTypars,_,_,_ = AnalyzeTypeOfMemberVal false g (typ,vref) memberParentTypars - | DefaultStructCtor(g,typ) -> - (tcrefOfAppTy g typ).Typars(m) -#if !NO_EXTENSIONTYPING - | ProvidedMeth (amap,_,_,_) -> - (tcrefOfAppTy amap.g x.EnclosingType).Typars(m) -#endif + | _ -> + x.DeclaringTyconRef.Typars(m) //------------------------------------------------------------------------- // ILFieldInfo @@ -1554,13 +1582,26 @@ type ILFieldInfo = #endif /// Get the enclosing ("parent"/"declaring") type of the field. - member x.EnclosingType = + member x.ApparentEnclosingType = match x with | ILFieldInfo(tinfo,_) -> tinfo.ToType #if !NO_EXTENSIONTYPING | ProvidedField(amap,fi,m) -> (Import.ImportProvidedType amap m (fi.PApply((fun fi -> fi.DeclaringType),m))) #endif + member x.ApparentEnclosingAppType = x.ApparentEnclosingType + + member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType + + member x.DeclaringTyconRef = x.ApparentEnclosingTyconRef + + member x.TcGlobals = + match x with + | ILFieldInfo(tinfo,_) -> tinfo.TcGlobals +#if !NO_EXTENSIONTYPING + | ProvidedField(amap,_,_) -> amap.g +#endif + /// Get a reference to the declaring type of the field as an ILTypeRef member x.ILTypeRef = match x with @@ -1572,10 +1613,10 @@ type ILFieldInfo = /// Get the scope used to interpret IL metadata member x.ScopeRef = x.ILTypeRef.Scope - /// Get the type instantiation of the declaring type of the field + /// Get the type instantiation of the declaring type of the field member x.TypeInst = match x with - | ILFieldInfo(tinfo,_) -> tinfo.TypeInst + | ILFieldInfo(tinfo,_) -> tinfo.TypeInstOfRawMetadata #if !NO_EXTENSIONTYPING | ProvidedField _ -> [] /// GENERIC TYPE PROVIDERS #endif @@ -1601,7 +1642,7 @@ type ILFieldInfo = match x with | ILFieldInfo(tinfo,_) -> tinfo.IsValueType #if !NO_EXTENSIONTYPING - | ProvidedField(amap,_,_) -> isStructTy amap.g x.EnclosingType + | ProvidedField(amap,_,_) -> isStructTy amap.g x.ApparentEnclosingType #endif /// Indicates if the field is static @@ -1643,7 +1684,7 @@ type ILFieldInfo = /// Get the type of the field as an F# type member x.FieldType(amap,m) = match x with - | ILFieldInfo (tinfo,fdef) -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] fdef.Type + | ILFieldInfo (tinfo,fdef) -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] fdef.Type #if !NO_EXTENSIONTYPING | ProvidedField(amap,fi,m) -> Import.ImportProvidedType amap m (fi.PApply((fun fi -> fi.FieldType),m)) #endif @@ -1693,7 +1734,7 @@ type RecdFieldInfo = member x.FieldType = actualTyOfRecdFieldRef x.RecdFieldRef x.TypeInst /// Get the enclosing (declaring) type of the field in an F#-declared record, class or struct type - member x.EnclosingType = TType_app (x.RecdFieldRef.TyconRef,x.TypeInst) + member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef,x.TypeInst) override x.ToString() = x.TyconRef.ToString() + "::" + x.Name @@ -1731,26 +1772,37 @@ type UnionCaseInfo = type ILPropInfo = | ILPropInfo of ILTypeInfo * ILPropertyDef + /// Get the TcGlobals governing this value + member x.TcGlobals = match x with ILPropInfo(tinfo,_) -> tinfo.TcGlobals + /// Get the declaring IL type of the IL property, including any generic instantiation - member x.ILTypeInfo = match x with (ILPropInfo(tinfo,_)) -> tinfo + member x.ILTypeInfo = match x with ILPropInfo(tinfo,_) -> tinfo + + /// Get the apparent declaring type of the method as an F# type. + /// If this is a C#-style extension method then this is the type which the method + /// appears to extend. This may be a variable type. + member x.ApparentEnclosingType = match x with ILPropInfo(tinfo,_) -> tinfo.ToType + + /// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type + member x.ApparentEnclosingAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType /// Get the raw Abstract IL metadata for the IL property - member x.RawMetadata = match x with (ILPropInfo(_,pd)) -> pd + member x.RawMetadata = match x with ILPropInfo(_,pd) -> pd /// Get the name of the IL property member x.PropertyName = x.RawMetadata.Name /// Gets the ILMethInfo of the 'get' method for the IL property - member x.GetterMethod(g) = + member x.GetterMethod = assert x.HasGetter let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.GetMethod.Value - ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[]) + ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[]) /// Gets the ILMethInfo of the 'set' method for the IL property - member x.SetterMethod(g) = + member x.SetterMethod = assert x.HasSetter let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.SetMethod.Value - ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[]) + ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[]) /// Indicates if the IL property has a 'get' method member x.HasGetter = Option.isSome x.RawMetadata.GetMethod @@ -1762,35 +1814,35 @@ type ILPropInfo = member x.IsStatic = (x.RawMetadata.CallingConv = ILThisConvention.Static) /// Indicates if the IL property is virtual - member x.IsVirtual(g) = - (x.HasGetter && x.GetterMethod(g).IsVirtual) || - (x.HasSetter && x.SetterMethod(g).IsVirtual) + member x.IsVirtual = + (x.HasGetter && x.GetterMethod.IsVirtual) || + (x.HasSetter && x.SetterMethod.IsVirtual) /// Indicates if the IL property is logically a 'newslot', i.e. hides any previous slots of the same name. - member x.IsNewSlot(g) = - (x.HasGetter && x.GetterMethod(g).IsNewSlot) || - (x.HasSetter && x.SetterMethod(g).IsNewSlot) + member x.IsNewSlot = + (x.HasGetter && x.GetterMethod.IsNewSlot) || + (x.HasSetter && x.SetterMethod.IsNewSlot) /// Get the names and types of the indexer arguments associated with the IL property. /// /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetParamNamesAndTypes(amap,m) = let (ILPropInfo (tinfo,pdef)) = x - pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] ty) ) + pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) ) /// Get the types of the indexer arguments associated with the IL property. /// /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetParamTypes(amap,m) = let (ILPropInfo (tinfo,pdef)) = x - pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] ty) + pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) /// Get the return type of the IL property. /// /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetPropertyType (amap,m) = let (ILPropInfo (tinfo,pdef)) = x - ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] pdef.Type + ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] pdef.Type override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.PropertyName @@ -1802,14 +1854,43 @@ type PropInfo = /// An F# use of a property backed by F#-declared metadata | FSProp of TcGlobals * TType * ValRef option * ValRef option /// An F# use of a property backed by Abstract IL metadata - | ILProp of TcGlobals * ILPropInfo + | ILProp of ILPropInfo #if !NO_EXTENSIONTYPING /// An F# use of a property backed by provided metadata | ProvidedProp of Import.ImportMap * Tainted * range #endif + /// Get the enclosing type of the property. + /// + /// If this is an extension member, then this is the apparent parent, i.e. the type the property appears to extend. + member x.ApparentEnclosingType = + match x with + | ILProp ilpinfo -> ilpinfo.ILTypeInfo.ToType + | FSProp(_,typ,_,_) -> typ +#if !NO_EXTENSIONTYPING + | ProvidedProp(amap,pi,m) -> + Import.ImportProvidedType amap m (pi.PApply((fun pi -> pi.DeclaringType),m)) +#endif + + /// Get the enclosing type of the method info, using a nominal type for tuple types + member x.ApparentEnclosingAppType = + match x with + | ILProp ilpinfo -> ilpinfo.ApparentEnclosingAppType + | _ -> x.ApparentEnclosingType + + member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType + + /// Get the declaring type or module holding the method. + /// Note that C#-style extension properties don't exist in the C# design as yet. + /// If this is an F#-style extension method it is the logical module + /// holding the value for the extension method. + member x.DeclaringTyconRef = + match x.ArbitraryValRef with + | Some vref when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity + | _ -> x.ApparentEnclosingTyconRef + /// Try to get an arbitrary F# ValRef associated with the member. This is to determine if the member is virtual, amongst other things. - member x.ArbitraryValRef = + member x.ArbitraryValRef : ValRef option = match x with | FSProp(_,_,Some vref,_) | FSProp(_,_,_, Some vref) -> Some vref @@ -1829,7 +1910,7 @@ type PropInfo = /// Get the logical name of the property. member x.PropertyName = match x with - | ILProp(_,x) -> x.PropertyName + | ILProp ilpinfo -> ilpinfo.PropertyName | FSProp(_,_,Some vref,_) | FSProp(_,_,_, Some vref) -> vref.PropertyName #if !NO_EXTENSIONTYPING @@ -1840,7 +1921,7 @@ type PropInfo = /// Indicates if this property has an associated getter method. member x.HasGetter = match x with - | ILProp(_,x) -> x.HasGetter + | ILProp ilpinfo-> ilpinfo.HasGetter | FSProp(_,_,x,_) -> Option.isSome x #if !NO_EXTENSIONTYPING | ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.CanRead),m) @@ -1849,33 +1930,24 @@ type PropInfo = /// Indicates if this property has an associated setter method. member x.HasSetter = match x with - | ILProp(_,x) -> x.HasSetter + | ILProp ilpinfo -> ilpinfo.HasSetter | FSProp(_,_,_,x) -> Option.isSome x #if !NO_EXTENSIONTYPING | ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.CanWrite),m) #endif - /// Get the enclosing type of the property. - /// - /// If this is an extension member, then this is the apparent parent, i.e. the type the property appears to extend. - member x.EnclosingType = - match x with - | ILProp(_,x) -> x.ILTypeInfo.ToType - | FSProp(_,typ,_,_) -> typ -#if !NO_EXTENSIONTYPING - | ProvidedProp(amap,pi,m) -> - Import.ImportProvidedType amap m (pi.PApply((fun pi -> pi.DeclaringType),m)) -#endif /// Indicates if this is an extension member member x.IsExtensionMember = - match x.ArbitraryValRef with Some vref -> vref.IsExtensionMember | _ -> false + match x.ArbitraryValRef with + | Some vref -> vref.IsExtensionMember + | _ -> false /// True if the getter (or, if absent, the setter) is a virtual method // REVIEW: for IL properties this is getter OR setter. For F# properties it is getter ELSE setter member x.IsVirtualProperty = match x with - | ILProp(g,x) -> x.IsVirtual(g) + | ILProp ilpinfo -> ilpinfo.IsVirtual | FSProp(_,_,Some vref,_) | FSProp(_,_,_, Some vref) -> vref.IsVirtualMember | FSProp _-> failwith "unreachable" @@ -1888,7 +1960,7 @@ type PropInfo = /// Indicates if the property is logically a 'newslot', i.e. hides any previous slots of the same name. member x.IsNewSlot = match x with - | ILProp(g,x) -> x.IsNewSlot(g) + | ILProp ilpinfo -> ilpinfo.IsNewSlot | FSProp(_,_,Some vref,_) | FSProp(_,_,_, Some vref) -> vref.IsDispatchSlotMember | FSProp(_,_,None,None) -> failwith "unreachable" @@ -1903,7 +1975,7 @@ type PropInfo = // REVIEW: for IL properties this is getter OR setter. For F# properties it is getter ELSE setter member x.IsDispatchSlot = match x with - | ILProp(g,x) -> x.IsVirtual(g) + | ILProp ilpinfo -> ilpinfo.IsVirtual | FSProp(g,typ,Some vref,_) | FSProp(g,typ,_, Some vref) -> isInterfaceTy g typ || (vref.MemberInfo.Value.MemberFlags.IsDispatchSlot) @@ -1917,7 +1989,7 @@ type PropInfo = /// Indicates if this property is static. member x.IsStatic = match x with - | ILProp(_,x) -> x.IsStatic + | ILProp ilpinfo -> ilpinfo.IsStatic | FSProp(_,_,Some vref,_) | FSProp(_,_,_, Some vref) -> not vref.IsInstanceMember | FSProp(_,_,None,None) -> failwith "unreachable" @@ -1944,7 +2016,7 @@ type PropInfo = /// Indicates if this property is an indexer property, i.e. a property with arguments. member x.IsIndexer = match x with - | ILProp(_,ILPropInfo(_,pdef)) -> pdef.Args.Length <> 0 + | ILProp(ILPropInfo(_,pdef)) -> pdef.Args.Length <> 0 | FSProp(g,_,Some vref,_) -> // A getter has signature { OptionalObjectType } -> Unit -> PropertyType // A getter indexer has signature { OptionalObjectType } -> TupledIndexerArguments -> PropertyType @@ -2002,7 +2074,7 @@ type PropInfo = /// Get the TcGlobals associated with the object member x.TcGlobals = match x with - | ILProp(g,_) -> g + | ILProp ilpinfo -> ilpinfo.TcGlobals | FSProp(g,_,_,_) -> g #if !NO_EXTENSIONTYPING | ProvidedProp(amap,_,_) -> amap.g @@ -2011,13 +2083,13 @@ type PropInfo = /// Indicates if the enclosing type for the property is a value type. /// /// For an extension property, this indicates if the property extends a struct type. - member x.IsValueType = isStructTy x.TcGlobals x.EnclosingType + member x.IsValueType = isStructTy x.TcGlobals x.ApparentEnclosingType /// Get the result type of the property member x.GetPropertyType (amap,m) = match x with - | ILProp (_,ilpinfo) -> ilpinfo.GetPropertyType (amap,m) + | ILProp ilpinfo -> ilpinfo.GetPropertyType (amap,m) | FSProp (g,typ,Some vref,_) | FSProp (g,typ,_,Some vref) -> let inst = GetInstantiationForPropertyVal g (typ,vref) @@ -2035,7 +2107,7 @@ type PropInfo = /// If the property is in a generic type, then the type parameters are instantiated in the types returned. member x.GetParamNamesAndTypes(amap,m) = match x with - | ILProp (_,ilpinfo) -> ilpinfo.GetParamNamesAndTypes(amap,m) + | ILProp ilpinfo -> ilpinfo.GetParamNamesAndTypes(amap,m) | FSProp (g,typ,Some vref,_) | FSProp (g,typ,_,Some vref) -> let inst = GetInstantiationForPropertyVal g (typ,vref) @@ -2061,7 +2133,7 @@ type PropInfo = /// Get a MethInfo for the 'getter' method associated with the property member x.GetterMethod = match x with - | ILProp(g,x) -> ILMeth(g,x.GetterMethod(g),None) + | ILProp ilpinfo -> ILMeth(x.TcGlobals, ilpinfo.GetterMethod, None) | FSProp(g,typ,Some vref,_) -> FSMeth(g,typ,vref,None) #if !NO_EXTENSIONTYPING | ProvidedProp(amap,pi,m) -> @@ -2074,7 +2146,7 @@ type PropInfo = /// Get a MethInfo for the 'setter' method associated with the property member x.SetterMethod = match x with - | ILProp(g,x) -> ILMeth(g,x.SetterMethod(g),None) + | ILProp ilpinfo -> ILMeth(x.TcGlobals, ilpinfo.SetterMethod, None) | FSProp(g,typ,_,Some vref) -> FSMeth(g,typ,vref,None) #if !NO_EXTENSIONTYPING | ProvidedProp(amap,pi,m) -> @@ -2092,7 +2164,7 @@ type PropInfo = | None, None -> true | _ -> false match x1,x2 with - | ILProp(_, x1), ILProp(_, x2) -> (x1.RawMetadata === x2.RawMetadata) + | ILProp ilpinfo1, ILProp ilpinfo2 -> (ilpinfo1.RawMetadata === ilpinfo2.RawMetadata) | FSProp(g, _, vrefa1, vrefb1), FSProp(_, _, vrefa2, vrefb2) -> (optVrefEq g (vrefa1, vrefa2)) && (optVrefEq g (vrefb1, vrefb2)) #if !NO_EXTENSIONTYPING @@ -2103,7 +2175,7 @@ type PropInfo = /// Calculates a hash code of property info (similar as previous) member pi.ComputeHashCode() = match pi with - | ILProp(_, x1) -> hash x1.RawMetadata.Name + | ILProp ilpinfo -> hash ilpinfo.RawMetadata.Name | FSProp(_,_,vrefOpt1, vrefOpt2) -> // Hash on option*option let vth = (vrefOpt1 |> Option.map (fun vr -> vr.LogicalName), (vrefOpt2 |> Option.map (fun vr -> vr.LogicalName))) @@ -2121,21 +2193,32 @@ type PropInfo = type ILEventInfo = | ILEventInfo of ILTypeInfo * ILEventDef + /// Get the enclosing ("parent"/"declaring") type of the field. + member x.ApparentEnclosingType = match x with ILEventInfo(tinfo,_) -> tinfo.ToType + + // Note: events are always associated with nominal types + member x.ApparentEnclosingAppType = x.ApparentEnclosingType + + // Note: IL Events are never extension members as C# has no notion of extension events as yet + member x.DeclaringTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType + + member x.TcGlobals = match x with ILEventInfo(tinfo,_) -> tinfo.TcGlobals + /// Get the raw Abstract IL metadata for the event - member x.RawMetadata = match x with (ILEventInfo(_,ed)) -> ed + member x.RawMetadata = match x with ILEventInfo(_,ed) -> ed /// Get the declaring IL type of the event as an ILTypeInfo - member x.ILTypeInfo = match x with (ILEventInfo(tinfo,_)) -> tinfo + member x.ILTypeInfo = match x with ILEventInfo(tinfo,_) -> tinfo /// Get the ILMethInfo describing the 'add' method associated with the event - member x.AddMethod(g) = + member x.AddMethod = let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.AddMethod - ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[]) + ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[]) /// Get the ILMethInfo describing the 'remove' method associated with the event - member x.RemoveMethod(g) = + member x.RemoveMethod = let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.RemoveMethod - ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[]) + ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[]) /// Get the declaring type of the event as an ILTypeRef member x.TypeRef = x.ILTypeInfo.ILTypeRef @@ -2144,7 +2227,7 @@ type ILEventInfo = member x.Name = x.RawMetadata.Name /// Indicates if the property is static - member x.IsStatic(g) = x.AddMethod(g).IsStatic + member x.IsStatic = x.AddMethod.IsStatic override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.Name //------------------------------------------------------------------------- @@ -2186,7 +2269,7 @@ type EventInfo = /// An F# use of an event backed by F#-declared metadata | FSEvent of TcGlobals * PropInfo * ValRef * ValRef /// An F# use of an event backed by .NET metadata - | ILEvent of TcGlobals * ILEventInfo + | ILEvent of ILEventInfo #if !NO_EXTENSIONTYPING /// An F# use of an event backed by provided metadata | ProvidedEvent of Import.ImportMap * Tainted * range @@ -2195,13 +2278,30 @@ type EventInfo = /// Get the enclosing type of the event. /// /// If this is an extension member, then this is the apparent parent, i.e. the type the event appears to extend. - member x.EnclosingType = + member x.ApparentEnclosingType = match x with - | ILEvent(_,e) -> e.ILTypeInfo.ToType - | FSEvent (_,p,_,_) -> p.EnclosingType + | ILEvent ileinfo -> ileinfo.ApparentEnclosingType + | FSEvent (_,p,_,_) -> p.ApparentEnclosingType #if !NO_EXTENSIONTYPING | ProvidedEvent (amap,ei,m) -> Import.ImportProvidedType amap m (ei.PApply((fun ei -> ei.DeclaringType),m)) #endif + /// Get the enclosing type of the method info, using a nominal type for tuple types + member x.ApparentEnclosingAppType = + match x with + | ILEvent ileinfo -> ileinfo.ApparentEnclosingAppType + | _ -> x.ApparentEnclosingType + + member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType + + /// Get the declaring type or module holding the method. + /// Note that C#-style extension properties don't exist in the C# design as yet. + /// If this is an F#-style extension method it is the logical module + /// holding the value for the extension method. + member x.DeclaringTyconRef = + match x.ArbitraryValRef with + | Some vref when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity + | _ -> x.ApparentEnclosingTyconRef + /// Indicates if this event has an associated XML comment authored in this assembly. member x.HasDirectXmlComment = @@ -2225,7 +2325,7 @@ type EventInfo = /// Get the logical name of the event. member x.EventName = match x with - | ILEvent(_,e) -> e.Name + | ILEvent ileinfo -> ileinfo.Name | FSEvent (_,p,_,_) -> p.PropertyName #if !NO_EXTENSIONTYPING | ProvidedEvent (_,ei,m) -> ei.PUntaint((fun ei -> ei.Name), m) @@ -2234,7 +2334,7 @@ type EventInfo = /// Indicates if this property is static. member x.IsStatic = match x with - | ILEvent(g,e) -> e.IsStatic(g) + | ILEvent ileinfo -> ileinfo.IsStatic | FSEvent (_,p,_,_) -> p.IsStatic #if !NO_EXTENSIONTYPING | ProvidedEvent (_,ei,m) -> @@ -2242,10 +2342,19 @@ type EventInfo = meth.PUntaint((fun mi -> mi.IsStatic), m) #endif + /// Indicates if this is an extension member + member x.IsExtensionMember = + match x with + | ILEvent _ -> false + | FSEvent (_,p,_,_) -> p.IsExtensionMember +#if !NO_EXTENSIONTYPING + | ProvidedEvent _ -> false +#endif + /// Get the TcGlobals associated with the object member x.TcGlobals = match x with - | ILEvent(g,_) -> g + | ILEvent ileinfo -> ileinfo.TcGlobals | FSEvent(g,_,_,_) -> g #if !NO_EXTENSIONTYPING | ProvidedEvent (amap,_,_) -> amap.g @@ -2254,13 +2363,13 @@ type EventInfo = /// Indicates if the enclosing type for the event is a value type. /// /// For an extension event, this indicates if the event extends a struct type. - member x.IsValueType = isStructTy x.TcGlobals x.EnclosingType + member x.IsValueType = isStructTy x.TcGlobals x.ApparentEnclosingType /// Get the 'add' method associated with an event - member x.GetAddMethod() = + member x.AddMethod = match x with - | ILEvent(g,e) -> ILMeth(g,e.AddMethod(g),None) - | FSEvent(g,p,addValRef,_) -> FSMeth(g,p.EnclosingType,addValRef,None) + | ILEvent ileinfo -> ILMeth(ileinfo.TcGlobals, ileinfo.AddMethod, None) + | FSEvent(g,p,addValRef,_) -> FSMeth(g,p.ApparentEnclosingType,addValRef,None) #if !NO_EXTENSIONTYPING | ProvidedEvent (amap,ei,m) -> let meth = GetAndSanityCheckProviderMethod m ei (fun ei -> ei.GetAddMethod()) FSComp.SR.etEventNoAdd @@ -2268,10 +2377,10 @@ type EventInfo = #endif /// Get the 'remove' method associated with an event - member x.GetRemoveMethod() = + member x.RemoveMethod = match x with - | ILEvent(g,e) -> ILMeth(g,e.RemoveMethod(g),None) - | FSEvent(g,p,_,removeValRef) -> FSMeth(g,p.EnclosingType,removeValRef,None) + | ILEvent ileinfo -> ILMeth(x.TcGlobals, ileinfo.RemoveMethod, None) + | FSEvent(g,p,_,removeValRef) -> FSMeth(g,p.ApparentEnclosingType,removeValRef,None) #if !NO_EXTENSIONTYPING | ProvidedEvent (amap,ei,m) -> let meth = GetAndSanityCheckProviderMethod m ei (fun ei -> ei.GetRemoveMethod()) FSComp.SR.etEventNoRemove @@ -2279,7 +2388,7 @@ type EventInfo = #endif /// Try to get an arbitrary F# ValRef associated with the member. This is to determine if the member is virtual, amongst other things. - member x.ArbitraryValRef = + member x.ArbitraryValRef: ValRef option = match x with | FSEvent(_,_,addValRef,_) -> Some addValRef | _ -> None @@ -2287,11 +2396,11 @@ type EventInfo = /// Get the delegate type associated with the event. member x.GetDelegateType(amap,m) = match x with - | ILEvent(_,ILEventInfo(tinfo,edef)) -> + | ILEvent(ILEventInfo(tinfo,edef)) -> // Get the delegate type associated with an IL event, taking into account the instantiation of the // declaring type. if Option.isNone edef.Type then error (nonStandardEventError x.EventName m) - ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] edef.Type.Value + ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] edef.Type.Value | FSEvent(g,p,_,_) -> FindDelegateTypeOfPropertyEvent g amap x.EventName m (p.GetPropertyType(amap,m)) @@ -2306,7 +2415,7 @@ type EventInfo = match x1, x2 with | FSEvent(g, pi1, vrefa1, vrefb1), FSEvent(_, pi2, vrefa2, vrefb2) -> PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2 && valRefEq g vrefa1 vrefa2 && valRefEq g vrefb1 vrefb2 - | ILEvent(_, x1), ILEvent(_, x2) -> (x1.RawMetadata === x2.RawMetadata) + | ILEvent ileinfo1, ILEvent ileinfo2 -> (ileinfo1.RawMetadata === ileinfo2.RawMetadata) #if !NO_EXTENSIONTYPING | ProvidedEvent (_,ei1,_), ProvidedEvent (_,ei2,_) -> ProvidedEventInfo.TaintedEquals (ei1, ei2) #endif @@ -2315,7 +2424,7 @@ type EventInfo = /// Calculates a hash code of event info (similar as previous) member ei.ComputeHashCode() = match ei with - | ILEvent(_, x1) -> hash x1.RawMetadata.Name + | ILEvent ileinfo -> hash ileinfo.RawMetadata.Name | FSEvent(_, pi, vref1, vref2) -> hash ( pi.ComputeHashCode(), vref1.LogicalName, vref2.LogicalName) #if !NO_EXTENSIONTYPING | ProvidedEvent (_,ei,_) -> ProvidedEventInfo.TaintedGetHashCode(ei) @@ -2341,7 +2450,7 @@ let CompiledSigOfMeth g amap m (minfo:MethInfo) = // of the enclosing type. For example, they may have constraints involving the _formal_ type parameters // of the enclosing type. This instantiations can be used to interpret those type parameters let fmtpinst = - let parentTyArgs = argsOfAppTy g minfo.EnclosingType + let parentTyArgs = argsOfAppTy g minfo.ApparentEnclosingAppType let memberParentTypars = minfo.GetFormalTyparsOfDeclaringType m mkTyparInst memberParentTypars parentTyArgs diff --git a/src/fsharp/service/ServiceAnalysis.fs b/src/fsharp/service/ServiceAnalysis.fs index 5923459c03..d8b05a2d06 100644 --- a/src/fsharp/service/ServiceAnalysis.fs +++ b/src/fsharp/service/ServiceAnalysis.fs @@ -130,7 +130,7 @@ module UnusedOpens = let usedByEnclosingEntity = match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as f -> - match f.EnclosingEntity with + match f.DeclaringEntity with | Some ent when ent.IsNamespace || ent.IsFSharpModule -> Some (ent.IsEffectivelySameAs modul.Entity) | _ -> None diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs index 6020e59c78..f4a7ac416c 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fs +++ b/src/fsharp/service/ServiceAssemblyContent.fs @@ -88,7 +88,7 @@ module Extensions = member x.TryGetFullCompiledOperatorNameIdents() : Idents option = // For operator ++ displayName is ( ++ ) compiledName is op_PlusPlus if isOperator x.DisplayName && x.DisplayName <> x.CompiledName then - x.EnclosingEntity + x.DeclaringEntity |> Option.bind (fun e -> e.TryGetFullName()) |> Option.map (fun enclosingEntityFullName -> Array.append (enclosingEntityFullName.Split '.') [| x.CompiledName |]) diff --git a/src/fsharp/service/ServiceDeclarationLists.fs b/src/fsharp/service/ServiceDeclarationLists.fs index 8fa9f7d450..ce7291f55e 100644 --- a/src/fsharp/service/ServiceDeclarationLists.fs +++ b/src/fsharp/service/ServiceDeclarationLists.fs @@ -560,9 +560,9 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT let items = items |> SymbolHelpers.RemoveExplicitlySuppressedCompletionItems g let tyconRefOptEq tref1 tref2 = - match tref1 with - | Some tref1 -> tyconRefEq g tref1 tref2 - | None -> false + match tref1, tref2 with + | Some tref1, tref2 -> tyconRefEq g tref1 tref2 + | _ -> false // Adjust items priority. Sort by name. For things with the same name, // - show types with fewer generic parameters first @@ -576,10 +576,10 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT | Item.FakeInterfaceCtor (TType_app(tcref,_)) | Item.DelegateCtor (TType_app(tcref,_)) -> { x with MinorPriority = 1000 + tcref.TyparsNoRange.Length } // Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name - | Item.CtorGroup (_, (cinfo :: _)) -> { x with MinorPriority = 1000 + 10 * (tcrefOfAppTy g cinfo.EnclosingType).TyparsNoRange.Length } - | Item.MethodGroup(_, minfo :: _, _) -> { x with IsOwnMember = tyconRefOptEq x.Type minfo.DeclaringEntityRef } - | Item.Property(_, pinfo :: _) -> { x with IsOwnMember = tyconRefOptEq x.Type (tcrefOfAppTy g pinfo.EnclosingType) } - | Item.ILField finfo -> { x with IsOwnMember = tyconRefOptEq x.Type (tcrefOfAppTy g finfo.EnclosingType) } + | Item.CtorGroup (_, (cinfo :: _)) -> { x with MinorPriority = 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length } + | Item.MethodGroup(_, minfo :: _, _) -> { x with IsOwnMember = tyconRefOptEq x.Type minfo.DeclaringTyconRef } + | Item.Property(_, pinfo :: _) -> { x with IsOwnMember = tyconRefOptEq x.Type pinfo.DeclaringTyconRef } + | Item.ILField finfo -> { x with IsOwnMember = tyconRefOptEq x.Type finfo.DeclaringTyconRef } | _ -> x) |> List.sortBy (fun x -> x.MinorPriority) |> List.fold (fun (prevRealPrior, prevNormalizedPrior, acc) x -> diff --git a/src/fsharp/service/ServiceInterfaceStubGenerator.fs b/src/fsharp/service/ServiceInterfaceStubGenerator.fs index 4f62581f1b..04b09ec157 100644 --- a/src/fsharp/service/ServiceInterfaceStubGenerator.fs +++ b/src/fsharp/service/ServiceInterfaceStubGenerator.fs @@ -325,7 +325,7 @@ module internal InterfaceStubGenerator = | _, true, _, name -> name + parArgs // Ordinary functions or values | false, _, _, name when - not (Symbol.hasAttribute v.LogicalEnclosingEntity.Attributes) -> + not (Symbol.hasAttribute v.ApparentEnclosingEntity.Attributes) -> name + " " + parArgs // Ordinary static members or things (?) that require fully qualified access | _, _, _, name -> name + parArgs @@ -448,7 +448,7 @@ module internal InterfaceStubGenerator = let internal (|TypeOfMember|_|) (m: FSharpMemberOrFunctionOrValue) = match m.FullTypeSafe with - | Some (MemberFunctionType typ) when m.IsProperty && m.EnclosingEntity.IsSome && m.EnclosingEntity.Value.IsFSharp -> + | Some (MemberFunctionType typ) when m.IsProperty && m.DeclaringEntity.IsSome && m.DeclaringEntity.Value.IsFSharp -> Some typ | Some typ -> Some typ | None -> None diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 90508a3061..a2561d73fb 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -364,7 +364,7 @@ type TypeCheckInfo let result = match cnrs with | CNR(_, Item.CtorGroup(_, ((ctor::_) as ctors)), _, denv, nenv, ad, m) ::_ -> - let props = ResolveCompletionsInType ncenv nenv ResolveCompletionTargets.SettablePropertiesAndFields m ad false ctor.EnclosingType + let props = ResolveCompletionsInType ncenv nenv ResolveCompletionTargets.SettablePropertiesAndFields m ad false ctor.ApparentEnclosingType let parameters = CollectParameters ctors amap m let items = props @ parameters Some (denv, m, items) @@ -974,7 +974,7 @@ type TypeCheckInfo | Item.FakeInterfaceCtor (TType_app(tcref,_)) | Item.DelegateCtor (TType_app(tcref,_)) -> 1000 + tcref.TyparsNoRange.Length // Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name - | Item.CtorGroup (_, (cinfo :: _)) -> 1000 + 10 * (tcrefOfAppTy g cinfo.EnclosingType).TyparsNoRange.Length + | Item.CtorGroup (_, (cinfo :: _)) -> 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length | _ -> 0 (d.Item.DisplayName,n)) @@ -1149,7 +1149,7 @@ type TypeCheckInfo let typeVarNames = getTypeVarNames ilinfo ParamTypeSymbol.tryOfILTypes typeVarNames ilinfo.ILMethodRef.ArgTypes |> Option.map (fun args -> - let externalSym = ExternalSymbol.Constructor (ilinfo.ILMethodRef.EnclosingTypeRef.FullName, args) + let externalSym = ExternalSymbol.Constructor (ilinfo.ILMethodRef.DeclaringTypeRef.FullName, args) FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym)) | _ -> None @@ -1159,33 +1159,33 @@ type TypeCheckInfo let typeVarNames = getTypeVarNames ilinfo ParamTypeSymbol.tryOfILTypes typeVarNames ilinfo.ILMethodRef.ArgTypes |> Option.map (fun args -> - let externalSym = ExternalSymbol.Method (ilinfo.ILMethodRef.EnclosingTypeRef.FullName, name, args, ilinfo.ILMethodRef.GenericArity) + let externalSym = ExternalSymbol.Method (ilinfo.ILMethodRef.DeclaringTypeRef.FullName, name, args, ilinfo.ILMethodRef.GenericArity) FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym)) | _ -> None - | Item.Property (name, ILProp (_, propInfo) :: _) -> + | Item.Property (name, ILProp propInfo :: _) -> let methInfo = - if propInfo.HasGetter then Some (propInfo.GetterMethod g) - elif propInfo.HasSetter then Some (propInfo.SetterMethod g) + if propInfo.HasGetter then Some propInfo.GetterMethod + elif propInfo.HasSetter then Some propInfo.SetterMethod else None match methInfo with | Some methInfo -> match methInfo.MetadataScope with | ILScopeRef.Assembly assref -> - let externalSym = ExternalSymbol.Property (methInfo.ILMethodRef.EnclosingTypeRef.FullName, name) + let externalSym = ExternalSymbol.Property (methInfo.ILMethodRef.DeclaringTypeRef.FullName, name) Some (FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym)) | _ -> None | None -> None - | Item.ILField (ILFieldInfo (ILTypeInfo (tr, _, _, _) & typeInfo, fieldDef)) when not tr.IsLocalRef -> + | Item.ILField (ILFieldInfo (typeInfo, fieldDef)) when not typeInfo.TyconRefOfRawMetadata.IsLocalRef -> match typeInfo.ILScopeRef with | ILScopeRef.Assembly assref -> let externalSym = ExternalSymbol.Field (typeInfo.ILTypeRef.FullName, fieldDef.Name) Some (FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym)) | _ -> None - | Item.Event (ILEvent (_, ILEventInfo (ILTypeInfo (tr, _, _, _) & typeInfo, eventDef))) when not tr.IsLocalRef -> + | Item.Event (ILEvent (ILEventInfo (typeInfo, eventDef))) when not typeInfo.TyconRefOfRawMetadata.IsLocalRef -> match typeInfo.ILScopeRef with | ILScopeRef.Assembly assref -> let externalSym = ExternalSymbol.Event (typeInfo.ILTypeRef.FullName, eventDef.Name) @@ -1353,7 +1353,7 @@ type TypeCheckInfo Some (m, SemanticClassificationType.ValueType) else Some (m, SemanticClassificationType.ReferenceType) | CNR(_, Item.CtorGroup(_, minfos), LegitTypeOccurence, _, _, _, m) -> - if minfos |> List.exists (fun minfo -> isStructTy g minfo.EnclosingType) then + if minfos |> List.exists (fun minfo -> isStructTy g minfo.ApparentEnclosingType) then Some (m, SemanticClassificationType.ValueType) else Some (m, SemanticClassificationType.ReferenceType) | CNR(_, Item.ExnCase _, LegitTypeOccurence, _, _, _, m) -> diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 8d15a98ae9..405ae4e7e9 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -511,22 +511,22 @@ module FSharpExprConvert = E.TupleGet(tyR, n, ConvExpr cenv env e) | TOp.ILAsm([ I_ldfld(_, _, fspec) ], _), enclTypeArgs, [obj] -> - let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs + let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs let objR = ConvLValueExpr cenv env obj E.ILFieldGet(Some objR, typR, fspec.Name) | TOp.ILAsm(( [ I_ldsfld (_, fspec) ] | [ I_ldsfld (_, fspec); AI_nop ]), _), enclTypeArgs, [] -> - let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs + let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs E.ILFieldGet(None, typR, fspec.Name) | TOp.ILAsm([ I_stfld(_, _, fspec) ], _), enclTypeArgs, [obj;arg] -> - let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs + let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs let objR = ConvLValueExpr cenv env obj let argR = ConvExpr cenv env arg E.ILFieldSet(Some objR, typR, fspec.Name, argR) | TOp.ILAsm([ I_stsfld(_, fspec) ], _), enclTypeArgs, [arg] -> - let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs + let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs let argR = ConvExpr cenv env arg E.ILFieldSet(None, typR, fspec.Name, argR) @@ -694,9 +694,9 @@ module FSharpExprConvert = // this does not matter currently, type checking fails to resolve it when a TP references a union case subclass try // if the type is an union case class, lookup will fail - Import.ImportILTypeRef cenv.amap m ilMethRef.EnclosingTypeRef, None + Import.ImportILTypeRef cenv.amap m ilMethRef.DeclaringTypeRef, None with _ -> - let e = ilMethRef.EnclosingTypeRef + let e = ilMethRef.DeclaringTypeRef let parent = ILTypeRef.Create(e.Scope, e.Enclosing.Tail, e.Enclosing.Head) Import.ImportILTypeRef cenv.amap m parent, Some e.Name @@ -736,7 +736,7 @@ module FSharpExprConvert = enclosingEntity.ModuleOrNamespaceType.AllValsAndMembers |> Seq.filter (fun v -> v.CompiledName = vName && - match v.ActualParent with + match v.DeclaringEntity with | Parent p -> p.PublicPath = enclosingEntity.PublicPath | _ -> false ) |> List.ofSeq @@ -843,7 +843,7 @@ module FSharpExprConvert = let logicalName = ilMethRef.Name let isMember = memberParentName.IsSome if isMember then - match ilMethRef.Name, ilMethRef.EnclosingTypeRef.Name with + match ilMethRef.Name, ilMethRef.DeclaringTypeRef.Name with | "Invoke", "Microsoft.FSharp.Core.FSharpFunc`2" -> let objR = ConvLValueExpr cenv env callArgs.Head let argR = ConvExpr cenv env callArgs.Tail.Head @@ -852,7 +852,7 @@ module FSharpExprConvert = | _ -> let isCtor = (ilMethRef.Name = ".ctor") let isStatic = isCtor || ilMethRef.CallingConv.IsStatic - let scoref = ilMethRef.EnclosingTypeRef.Scope + let scoref = ilMethRef.DeclaringTypeRef.Scope let typars1 = tcref.Typars(m) let typars2 = [ 1 .. ilMethRef.GenericArity ] |> List.map (fun _ -> NewRigidTypar "T" m) let tinst1 = typars1 |> generalizeTypars diff --git a/src/fsharp/symbols/SymbolHelpers.fs b/src/fsharp/symbols/SymbolHelpers.fs index c13731306d..a2997654b7 100644 --- a/src/fsharp/symbols/SymbolHelpers.fs +++ b/src/fsharp/symbols/SymbolHelpers.fs @@ -393,7 +393,7 @@ module internal SymbolHelpers = | _ -> minfo.ArbitraryValRef |> Option.bind ccuOfValRef - |> Option.orElseWith (fun () -> minfo.DeclaringEntityRef |> computeCcuOfTyconRef) + |> Option.orElseWith (fun () -> minfo.DeclaringTyconRef |> computeCcuOfTyconRef) let rec ccuOfItem (g:TcGlobals) d = @@ -403,13 +403,13 @@ module internal SymbolHelpers = | Item.ActivePatternCase apref -> ccuOfValRef apref.ActivePatternVal | Item.ExnCase tcref -> computeCcuOfTyconRef tcref | Item.RecdField rfinfo -> computeCcuOfTyconRef rfinfo.RecdFieldRef.TyconRef - | Item.Event einfo -> einfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef - | Item.ILField finfo -> finfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef + | Item.Event einfo -> einfo.DeclaringTyconRef |> computeCcuOfTyconRef + | Item.ILField finfo -> finfo.DeclaringTyconRef |> computeCcuOfTyconRef | Item.Property(_, pinfos) -> pinfos |> List.tryPick (fun pinfo -> pinfo.ArbitraryValRef |> Option.bind ccuOfValRef - |> Option.orElseWith (fun () -> pinfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef)) + |> Option.orElseWith (fun () -> pinfo.DeclaringTyconRef |> computeCcuOfTyconRef)) | Item.ArgName (_, _, Some (ArgumentContainer.Method minfo)) -> ccuOfMethInfo g minfo @@ -498,8 +498,8 @@ module internal SymbolHelpers = let GetXmlDocSigOfScopedValRef g (tcref:TyconRef) (vref:ValRef) = let ccuFileName = libFileOfEntityRef tcref let v = vref.Deref - if v.XmlDocSig = "" && v.HasTopValActualParent then - v.XmlDocSig <- XmlDocSigOfVal g (buildAccessPath vref.TopValActualParent.CompilationPathOpt) v + if v.XmlDocSig = "" && v.HasDeclaringEntity then + v.XmlDocSig <- XmlDocSigOfVal g (buildAccessPath vref.TopValDeclaringEntity.CompilationPathOpt) v Some (ccuFileName, v.XmlDocSig) let GetXmlDocSigOfRecdFieldInfo (rfinfo:RecdFieldInfo) = @@ -520,7 +520,7 @@ module internal SymbolHelpers = let amap = infoReader.amap match minfo with | FSMeth (g, _, vref, _) -> - GetXmlDocSigOfScopedValRef g minfo.DeclaringEntityRef vref + GetXmlDocSigOfScopedValRef g minfo.DeclaringTyconRef vref | ILMeth (g, ilminfo, _) -> let actualTypeName = ilminfo.DeclaringTyconRef.CompiledRepresentationForNamedType.FullName let fmtps = ilminfo.FormalMethodTypars @@ -549,25 +549,24 @@ module internal SymbolHelpers = if not vref.IsLocalRef then let ccuFileName = vref.nlr.Ccu.FileName let v = vref.Deref - if v.XmlDocSig = "" && v.HasTopValActualParent then - v.XmlDocSig <- XmlDocSigOfVal g vref.TopValActualParent.CompiledRepresentationForNamedType.Name v + if v.XmlDocSig = "" && v.HasDeclaringEntity then + v.XmlDocSig <- XmlDocSigOfVal g vref.TopValDeclaringEntity.CompiledRepresentationForNamedType.Name v Some (ccuFileName, v.XmlDocSig) else None - let GetXmlDocSigOfProp infoReader m pinfo = + let GetXmlDocSigOfProp infoReader m (pinfo: PropInfo) = + let g = pinfo.TcGlobals match pinfo with #if !NO_EXTENSIONTYPING | ProvidedProp _ -> None // No signature is possible. If an xml comment existed it would have been returned by PropInfo.XmlDoc in infos.fs #endif - | FSProp (g, typ, _, _) as fspinfo -> - let tcref = tcrefOfAppTy g typ + | FSProp _ as fspinfo -> match fspinfo.ArbitraryValRef with | None -> None - | Some vref -> GetXmlDocSigOfScopedValRef g tcref vref - | ILProp(g, (ILPropInfo(tinfo, pdef))) -> - let tcref = tinfo.TyconRef - match metaInfoOfEntityRef infoReader m tcref with + | Some vref -> GetXmlDocSigOfScopedValRef g pinfo.DeclaringTyconRef vref + | ILProp(ILPropInfo(_, pdef)) -> + match metaInfoOfEntityRef infoReader m pinfo.DeclaringTyconRef with | Some (ccuFileName, formalTypars, formalTypeInfo) -> let filpinfo = ILPropInfo(formalTypeInfo, pdef) Some (ccuFileName, "P:"+formalTypeInfo.ILTypeRef.FullName+"."+pdef.Name+XmlDocArgsEnc g (formalTypars, []) (filpinfo.GetParamTypes(infoReader.amap, m))) @@ -575,17 +574,15 @@ module internal SymbolHelpers = let GetXmlDocSigOfEvent infoReader m (einfo:EventInfo) = match einfo with - | ILEvent(_, ilEventInfo) -> - let tinfo = ilEventInfo.ILTypeInfo - let tcref = tinfo.TyconRef - match metaInfoOfEntityRef infoReader m tcref with + | ILEvent _ -> + match metaInfoOfEntityRef infoReader m einfo.DeclaringTyconRef with | Some (ccuFileName, _, formalTypeInfo) -> Some(ccuFileName, "E:"+formalTypeInfo.ILTypeRef.FullName+"."+einfo.EventName) | _ -> None | _ -> None let GetXmlDocSigOfILFieldInfo infoReader m (finfo:ILFieldInfo) = - match metaInfoOfEntityRef infoReader m (tcrefOfAppTy infoReader.g finfo.EnclosingType) with + match metaInfoOfEntityRef infoReader m finfo.DeclaringTyconRef with | Some (ccuFileName, _, formalTypeInfo) -> Some(ccuFileName, "F:"+formalTypeInfo.ILTypeRef.FullName+"."+finfo.FieldName) | _ -> None @@ -706,7 +703,7 @@ module internal SymbolHelpers = // This may explore assemblies that are not in the reference set. // In this case just bail out and assume items are not equal protectAssemblyExploration false (fun () -> - let equalTypes(ty1, ty2) = + let equalHeadTypes(ty1, ty2) = if isAppTy g ty1 && isAppTy g ty2 then tyconRefEq g (tcrefOfAppTy g ty1) (tcrefOfAppTy g ty2) else typeEquiv g ty1 ty2 @@ -714,13 +711,13 @@ module internal SymbolHelpers = // Much of this logic is already covered by 'ItemsAreEffectivelyEqual' match item1, item2 with - | Item.DelegateCtor(ty1), Item.DelegateCtor(ty2) -> equalTypes(ty1, ty2) + | Item.DelegateCtor(ty1), Item.DelegateCtor(ty2) -> equalHeadTypes(ty1, ty2) | Item.Types(dn1, [ty1]), Item.Types(dn2, [ty2]) -> // Bug 4403: We need to compare names as well, because 'int' and 'Int32' are physically the same type, but we want to show both - dn1 = dn2 && equalTypes(ty1, ty2) + dn1 = dn2 && equalHeadTypes(ty1, ty2) // Prefer a type to a DefaultStructCtor, a DelegateCtor and a FakeInterfaceCtor - | ItemWhereTypIsPreferred(ty1), ItemWhereTypIsPreferred(ty2) -> equalTypes(ty1, ty2) + | ItemWhereTypIsPreferred(ty1), ItemWhereTypIsPreferred(ty2) -> equalHeadTypes(ty1, ty2) | Item.ExnCase(tcref1), Item.ExnCase(tcref2) -> tyconRefEq g tcref1 tcref2 | Item.ILField(ILFieldInfo(_, fld1)), Item.ILField(ILFieldInfo(_, fld2)) -> @@ -823,7 +820,7 @@ module internal SymbolHelpers = | Item.Types(it, [ty]) -> g.suppressed_types |> List.exists (fun supp -> - if isAppTy g ty then + if isAppTy g ty && isAppTy g (generalizedTyconRef supp) then // check if they are the same logical type (after removing all abbreviations) let tcr1 = tcrefOfAppTy g ty let tcr2 = tcrefOfAppTy g (generalizedTyconRef supp) @@ -861,12 +858,12 @@ module internal SymbolHelpers = | Item.RecdField rfinfo -> fullDisplayTextOfRecdFieldRef rfinfo.RecdFieldRef | Item.NewDef id -> id.idText | Item.ILField finfo -> bufs (fun os -> NicePrint.outputILTypeRef denv os finfo.ILTypeRef; bprintf os ".%s" finfo.FieldName) - | Item.Event einfo -> bufs (fun os -> NicePrint.outputTyconRef denv os (tcrefOfAppTy g einfo.EnclosingType); bprintf os ".%s" einfo.EventName) - | Item.Property(_, (pinfo::_)) -> bufs (fun os -> NicePrint.outputTyconRef denv os (tcrefOfAppTy g pinfo.EnclosingType); bprintf os ".%s" pinfo.PropertyName) + | Item.Event einfo -> bufs (fun os -> NicePrint.outputTyconRef denv os einfo.DeclaringTyconRef; bprintf os ".%s" einfo.EventName) + | Item.Property(_, (pinfo::_)) -> bufs (fun os -> NicePrint.outputTyconRef denv os pinfo.DeclaringTyconRef; bprintf os ".%s" pinfo.PropertyName) | Item.CustomOperation (customOpName, _, _) -> customOpName - | Item.CtorGroup(_, minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef) - | Item.MethodGroup(_, _, Some minfo) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName) - | Item.MethodGroup(_, minfo :: _, _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName) + | Item.CtorGroup(_, minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef) + | Item.MethodGroup(_, _, Some minfo) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef; bprintf os ".%s" minfo.DisplayName) + | Item.MethodGroup(_, minfo :: _, _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef; bprintf os ".%s" minfo.DisplayName) | Item.UnqualifiedType (tcref :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os tcref) | Item.FakeInterfaceCtor typ | Item.DelegateCtor typ @@ -1082,7 +1079,7 @@ module internal SymbolHelpers = let rty, _cxs = PrettyTypes.PrettifyType g rty let layout = wordL (tagText (FSComp.SR.typeInfoEvent())) ^^ - NicePrint.layoutTyconRef denv (tcrefOfAppTy g einfo.EnclosingType) ^^ + NicePrint.layoutTyconRef denv einfo.ApparentEnclosingTyconRef ^^ SepL.dot ^^ wordL (tagEvent einfo.EventName) ^^ RightL.colon ^^ @@ -1113,7 +1110,7 @@ module internal SymbolHelpers = ) ^^ SepL.lineBreak ^^ SepL.lineBreak ^^ wordL (tagText (FSComp.SR.typeInfoCallsWord())) ^^ - NicePrint.layoutTyconRef denv (tcrefOfAppTy g minfo.EnclosingType) ^^ + NicePrint.layoutTyconRef denv minfo.ApparentEnclosingTyconRef ^^ SepL.dot ^^ wordL (tagMethod minfo.DisplayName) @@ -1273,7 +1270,7 @@ module internal SymbolHelpers = let getKeywordForMethInfo (minfo : MethInfo) = match minfo with | FSMeth(_, _, vref, _) -> - match vref.ActualParent with + match vref.DeclaringEntity with | Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.CompiledName|> Some | ParentNone -> None @@ -1293,8 +1290,8 @@ module internal SymbolHelpers = match item with | Item.Value vref | Item.CustomBuilder (_, vref) -> let v = vref.Deref - if v.IsModuleBinding && v.HasTopValActualParent then - let tyconRef = v.TopValActualParent + if v.IsModuleBinding && v.HasDeclaringEntity then + let tyconRef = v.TopValDeclaringEntity let paramsString = match v.Typars with | [] -> "" @@ -1316,7 +1313,7 @@ module internal SymbolHelpers = | Item.ILField finfo -> match finfo with | ILFieldInfo(tinfo, fdef) -> - (tinfo.TyconRef |> ticksAndArgCountTextOfTyconRef)+"."+fdef.Name |> Some + (tinfo.TyconRefOfRawMetadata |> ticksAndArgCountTextOfTyconRef)+"."+fdef.Name |> Some #if !NO_EXTENSIONTYPING | ProvidedField _ -> None #endif @@ -1362,13 +1359,13 @@ module internal SymbolHelpers = | FSProp(_, _, Some vref, _) | FSProp(_, _, _, Some vref) -> // per spec, extension members in F1 keywords are qualified with definition class - match vref.ActualParent with + match vref.DeclaringEntity with | Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.PropertyName|> Some | ParentNone -> None - | ILProp(_, (ILPropInfo(tinfo, pdef))) -> - let tcref = tinfo.TyconRef + | ILProp(ILPropInfo(tinfo, pdef)) -> + let tcref = tinfo.TyconRefOfRawMetadata (tcref |> ticksAndArgCountTextOfTyconRef)+"."+pdef.Name |> Some | FSProp _ -> None #if !NO_EXTENSIONTYPING @@ -1378,15 +1375,14 @@ module internal SymbolHelpers = | Item.Event einfo -> match einfo with - | ILEvent(_, ilEventInfo) -> - let tinfo = ilEventInfo.ILTypeInfo - let tcref = tinfo.TyconRef + | ILEvent _ -> + let tcref = einfo.DeclaringTyconRef (tcref |> ticksAndArgCountTextOfTyconRef)+"."+einfo.EventName |> Some | FSEvent(_, pinfo, _, _) -> match pinfo.ArbitraryValRef with | Some vref -> // per spec, members in F1 keywords are qualified with definition class - match vref.ActualParent with + match vref.DeclaringEntity with | Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.PropertyName|> Some | ParentNone -> None | None -> None @@ -1397,18 +1393,15 @@ module internal SymbolHelpers = match minfos with | [] -> None | FSMeth(_, _, vref, _) :: _ -> - match vref.ActualParent with + match vref.DeclaringEntity with | Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef) + ".#ctor"|> Some | ParentNone -> None - | (ILMeth (_, minfo, _)) :: _ -> - let tcref = minfo.DeclaringTyconRef - (tcref |> ticksAndArgCountTextOfTyconRef)+".#ctor" |> Some - | (DefaultStructCtor (g, typ) :: _) -> - let tcref = tcrefOfAppTy g typ - (ticksAndArgCountTextOfTyconRef tcref) + ".#ctor" |> Some #if !NO_EXTENSIONTYPING | ProvidedMeth _::_ -> None #endif + | minfo :: _ -> + let tcref = minfo.DeclaringTyconRef + (tcref |> ticksAndArgCountTextOfTyconRef)+".#ctor" |> Some | Item.CustomOperation (_, _, Some minfo) -> getKeywordForMethInfo minfo | Item.MethodGroup(_, _, Some minfo) -> getKeywordForMethInfo minfo | Item.MethodGroup(_, minfo :: _, _) -> getKeywordForMethInfo minfo diff --git a/src/fsharp/symbols/SymbolPatterns.fs b/src/fsharp/symbols/SymbolPatterns.fs index 8ae4b90bf9..22b406e12f 100644 --- a/src/fsharp/symbols/SymbolPatterns.fs +++ b/src/fsharp/symbols/SymbolPatterns.fs @@ -202,7 +202,7 @@ module Symbol = /// Constructor (enclosingEntity) let (|Constructor|_|) (func: FSharpMemberOrFunctionOrValue) = match func.CompiledName with - | ".ctor" | ".cctor" -> func.EnclosingEntity + | ".ctor" | ".cctor" -> func.DeclaringEntity | _ -> None let (|Function|_|) excluded (func: FSharpMemberOrFunctionOrValue) = diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index 43ba54e081..b3da397df6 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -491,7 +491,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) = else for minfo in GetImmediateIntrinsicMethInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy do yield createMember minfo - let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy + let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy let events = cenv.infoReader.GetImmediateIntrinsicEventsOfType (None, AccessibleFromSomeFSharpCode, range0, entityTy) for pinfo in props do yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) @@ -505,7 +505,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) = // For F#-declared extension members, yield a value-backed member and a property info if possible let vref = mkNestedValRef entity v yield FSharpMemberOrFunctionOrValue(cenv, V vref, Item.Value vref) - match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentParent with + match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentEnclosingEntity with | MemberKind.PropertyGet, Parent p -> let pinfo = FSProp(cenv.g, generalizedTyconRef p, Some vref, None) yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) @@ -565,7 +565,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) = let formalTypeInfo = ILTypeInfo.FromType cenv.g ty tdef.Fields.AsList |> List.map (fun tdef -> let ilFieldInfo = ILFieldInfo(formalTypeInfo, tdef) - FSharpField(cenv, FSharpFieldData.ILField(cenv.g, ilFieldInfo) )) + FSharpField(cenv, FSharpFieldData.ILField(ilFieldInfo) )) |> makeReadOnlyCollection else @@ -711,19 +711,21 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) = and FSharpFieldData = - | ILField of TcGlobals * ILFieldInfo + | ILField of ILFieldInfo | RecdOrClass of RecdFieldRef | Union of UnionCaseRef * int + member x.TryRecdField = match x with | RecdOrClass v -> v.RecdField |> Choice1Of2 | Union (v, n) -> v.FieldByIndex(n) |> Choice1Of2 - | ILField (_, f) -> f |> Choice2Of2 + | ILField f -> f |> Choice2Of2 + member x.DeclaringTyconRef = match x with | RecdOrClass v -> v.TyconRef | Union (v, _) -> v.TyconRef - | ILField (g, f) -> tcrefOfAppTy g f.EnclosingType + | ILField f -> f.DeclaringTyconRef and FSharpField(cenv: cenv, d: FSharpFieldData) = inherit FSharpSymbol (cenv, @@ -735,8 +737,8 @@ and FSharpField(cenv: cenv, d: FSharpFieldData) = | Union (v, _) -> // This is not correct: there is no "Item" for a named union case field Item.UnionCase(UnionCaseInfo(generalizeTypars v.TyconRef.TyparsNoRange, v), false) - | ILField (_, f) -> - Item.ILField(f)), + | ILField f -> + Item.ILField f), (fun this thisCcu2 ad -> checkForCrossProjectAccessibility (thisCcu2, ad) (cenv.thisCcu, (this :?> FSharpField).Accessibility.Contents)) //&& @@ -812,7 +814,7 @@ and FSharpField(cenv: cenv, d: FSharpFieldData) = | Union (v, _) -> let unionCase = UnionCaseInfo(generalizeTypars v.TyconRef.TyparsNoRange, v) SymbolHelpers.GetXmlDocSigOfUnionCaseInfo unionCase - | ILField (_, f) -> + | ILField f -> SymbolHelpers.GetXmlDocSigOfILFieldInfo cenv.infoReader range0 f match xmlsig with | Some (_, docsig) -> docsig @@ -937,10 +939,10 @@ and FSharpActivePatternGroup(cenv, apinfo:PrettyNaming.ActivePatternInfo, typ, v member __.OverallType = FSharpType(cenv, typ) - member __.EnclosingEntity = + member __.DeclaringEntity = valOpt |> Option.bind (fun vref -> - match vref.ActualParent with + match vref.DeclaringEntity with | ParentNone -> None | Parent p -> Some (FSharpEntity(cenv, p))) @@ -1258,14 +1260,25 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | Some v -> v | None -> failwith "DeclarationLocation property not available" - member __.LogicalEnclosingEntity = + member __.DeclaringEntity = checkIsResolved() match d with - | E m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) - | P m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) - | M m | C m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) + | E e -> FSharpEntity(cenv, e.DeclaringTyconRef) |> Some + | P p -> FSharpEntity(cenv, p.DeclaringTyconRef) |> Some + | M m | C m -> FSharpEntity(cenv, m.DeclaringTyconRef) |> Some | V v -> - match v.ApparentParent with + match v.DeclaringEntity with + | ParentNone -> None + | Parent p -> FSharpEntity(cenv, p) |> Some + + member __.ApparentEnclosingEntity = + checkIsResolved() + match d with + | E e -> FSharpEntity(cenv, e.ApparentEnclosingTyconRef) + | P p -> FSharpEntity(cenv, p.ApparentEnclosingTyconRef) + | M m | C m -> FSharpEntity(cenv, m.ApparentEnclosingTyconRef) + | V v -> + match v.ApparentEnclosingEntity with | ParentNone -> invalidOp "the value or member doesn't have a logical parent" | Parent p -> FSharpEntity(cenv, p) @@ -1296,7 +1309,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = if isUnresolved() then false else match d with - | P m -> m.HasGetter + | P p -> p.HasGetter | E _ | M _ | C _ @@ -1305,19 +1318,35 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member __.GetterMethod = checkIsResolved() match d with - | P m -> mkMethSym m.GetterMethod + | P p -> mkMethSym p.GetterMethod | E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated getter method" + member __.HasSetterMethod = + if isUnresolved() then false + else + match d with + | P p -> p.HasSetter + | E _ + | M _ + | C _ + | V _ -> false + + member __.SetterMethod = + checkIsResolved() + match d with + | P p -> mkMethSym p.SetterMethod + | E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated setter method" + member __.EventAddMethod = checkIsResolved() match d with - | E e -> mkMethSym (e.GetAddMethod()) + | E e -> mkMethSym e.AddMethod | P _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated add method" member __.EventRemoveMethod = checkIsResolved() match d with - | E e -> mkMethSym (e.GetRemoveMethod()) + | E e -> mkMethSym e.RemoveMethod | P _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated remove method" member __.EventDelegateType = @@ -1334,33 +1363,6 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = TryDestStandardDelegateTyp cenv.infoReader range0 AccessibleFromSomewhere dty |> Option.isSome | P _ | M _ | C _ | V _ -> invalidOp "the value or member is not an event" - member __.HasSetterMethod = - if isUnresolved() then false - else - match d with - | P m -> m.HasSetter - | E _ - | M _ - | C _ - | V _ -> false - - member __.SetterMethod = - checkIsResolved() - match d with - | P m -> mkMethSym m.SetterMethod - | E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated setter method" - - member __.EnclosingEntity = - checkIsResolved() - match d with - | E m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) |> Some - | P m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) |> Some - | M m | C m -> FSharpEntity(cenv, m.DeclaringEntityRef) |> Some - | V v -> - match v.ActualParent with - | ParentNone -> None - | Parent p -> FSharpEntity(cenv, p) |> Some - member __.IsCompilerGenerated = if isUnresolved() then false else match fsharpInfo() with @@ -1400,7 +1402,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member __.IsDispatchSlot = if isUnresolved() then false else match d with - | E e -> e.GetAddMethod().IsDispatchSlot + | E e -> e.AddMethod.IsDispatchSlot | P p -> p.IsDispatchSlot | M m | C m -> m.IsDispatchSlot | V v -> v.IsDispatchSlot @@ -1418,8 +1420,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member x.EventForFSharpProperty = match d with | P p when p.IsFSharpEventProperty -> - let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType - let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType + let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.ApparentEnclosingType + let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.ApparentEnclosingType match minfos1, minfos2 with | [addMeth], [removeMeth] -> match addMeth.ArbitraryValRef, removeMeth.ArbitraryValRef with @@ -1433,9 +1435,10 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWith("add_") -> let eventName = m.LogicalName.[4..] - let entityTy = generalizedTyconRef m.DeclaringEntityRef + let entityTy = generalizedTyconRef m.DeclaringTyconRef not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) || - match GetImmediateIntrinsicPropInfosOfType(Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef) with + let declaringTy = generalizedTyconRef m.DeclaringTyconRef + match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with | pinfo :: _ -> pinfo.IsFSharpEventProperty | _ -> false @@ -1446,9 +1449,10 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWith("remove_") -> let eventName = m.LogicalName.[7..] - let entityTy = generalizedTyconRef m.DeclaringEntityRef + let entityTy = generalizedTyconRef m.DeclaringTyconRef not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) || - match GetImmediateIntrinsicPropInfosOfType(Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef) with + let declaringTy = generalizedTyconRef m.DeclaringTyconRef + match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with | pinfo :: _ -> pinfo.IsFSharpEventProperty | _ -> false | _ -> false @@ -1472,7 +1476,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWith("get_") -> let propName = PrettyNaming.ChopPropertyName(m.LogicalName) - not (isNil (GetImmediateIntrinsicPropInfosOfType(Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef))) + let declaringTy = generalizedTyconRef m.DeclaringTyconRef + not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy)) | V v -> v.IsPropertyGetterMethod | _ -> false @@ -1482,7 +1487,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = // Look for a matching property with the right name. | M m when m.LogicalName.StartsWith("set_") -> let propName = PrettyNaming.ChopPropertyName(m.LogicalName) - not (isNil (GetImmediateIntrinsicPropInfosOfType(Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef))) + let declaringTy = generalizedTyconRef m.DeclaringTyconRef + not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy)) | V v -> v.IsPropertySetterMethod | _ -> false @@ -1506,7 +1512,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member __.IsExtensionMember = if isUnresolved() then false else match d with - | E e -> e.GetAddMethod().IsExtensionMember + | E e -> e.AddMethod.IsExtensionMember | P p -> p.IsExtensionMember | M m -> m.IsExtensionMember | V v -> v.IsExtensionMember @@ -1516,7 +1522,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member __.IsOverrideOrExplicitInterfaceImplementation = if isUnresolved() then false else match d with - | E e -> e.GetAddMethod().IsDefiniteFSharpOverride + | E e -> e.AddMethod.IsDefiniteFSharpOverride | P p -> p.IsDefiniteFSharpOverride | M m -> m.IsDefiniteFSharpOverride | V v -> @@ -1526,7 +1532,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = member __.IsExplicitInterfaceImplementation = if isUnresolved() then false else match d with - | E e -> e.GetAddMethod().IsFSharpExplicitInterfaceImplementation + | E e -> e.AddMethod.IsFSharpExplicitInterfaceImplementation | P p -> p.IsFSharpExplicitInterfaceImplementation | M m -> m.IsFSharpExplicitInterfaceImplementation | V v -> v.IsFSharpExplicitInterfaceImplementation cenv.g @@ -1536,7 +1542,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = checkIsResolved() let sigs = match d with - | E e -> e.GetAddMethod().ImplementedSlotSignatures + | E e -> e.AddMethod.ImplementedSlotSignatures | P p -> p.ImplementedSlotSignatures | M m | C m -> m.ImplementedSlotSignatures | V v -> v.ImplementedSlotSignatures @@ -1603,7 +1609,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | Some (_, docsig) -> docsig | _ -> "" | V v -> - match v.ActualParent with + match v.DeclaringEntity with | Parent entityRef -> match SymbolHelpers.GetXmlDocSigOfScopedValRef cenv.g entityRef v with | Some (_, docsig) -> docsig @@ -1766,9 +1772,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = // For IL events, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private" let access = match e with - | ILEvent (_, x) -> - let ilAccess = AccessibilityLogic.GetILAccessOfILEventInfo x - getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess + | ILEvent ileinfo -> + let ilAccess = AccessibilityLogic.GetILAccessOfILEventInfo ileinfo + getApproxFSharpAccessibilityOfMember this.DeclaringEntity.Value.Entity ilAccess | _ -> taccessPublic FSharpAccessibility(access) @@ -1777,9 +1783,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = // For IL properties, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private" let access = match p with - | ILProp (_, x) -> - let ilAccess = AccessibilityLogic.GetILAccessOfILPropInfo x - getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess + | ILProp ilpinfo -> + let ilAccess = AccessibilityLogic.GetILAccessOfILPropInfo ilpinfo + getApproxFSharpAccessibilityOfMember this.DeclaringEntity.Value.Entity ilAccess | _ -> taccessPublic FSharpAccessibility(access) @@ -2060,7 +2066,7 @@ and FSharpAttribute(cenv: cenv, attrib: AttribInfo) = NicePrint.stringOfFSAttrib (denv.Contents g) attrib | AttribInfo.ILAttribInfo (g, _, _scoref, cattr, _) -> let parms, _args = decodeILAttribData g.ilg cattr - NicePrint.stringOfILAttrib (denv.Contents g) (cattr.Method.EnclosingType, parms) + NicePrint.stringOfILAttrib (denv.Contents g) (cattr.Method.DeclaringType, parms) override __.ToString() = if entityIsUnresolved attrib.TyconRef then "attribute ???" else "attribute " + attrib.TyconRef.CompiledName + "(...)" @@ -2208,7 +2214,7 @@ type FSharpSymbol with | Item.ExnCase tcref -> FSharpEntity(cenv, tcref) :>_ | Item.RecdField rfinfo -> FSharpField(cenv, RecdOrClass rfinfo.RecdFieldRef) :> _ - | Item.ILField finfo -> FSharpField(cenv, ILField (cenv.g, finfo)) :> _ + | Item.ILField finfo -> FSharpField(cenv, ILField finfo) :> _ | Item.Event einfo -> FSharpMemberOrFunctionOrValue(cenv, E einfo, item) :> _ diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi index 5d9c1b9417..462544bd20 100644 --- a/src/fsharp/symbols/Symbols.fsi +++ b/src/fsharp/symbols/Symbols.fsi @@ -641,8 +641,11 @@ and [] public FSharpMemberOrFunctionOrValue = member IsUnresolved : bool /// Get the enclosing entity for the definition - member EnclosingEntity : FSharpEntity option + member DeclaringEntity : FSharpEntity option + /// Get the logical enclosing entity, which for an extension member is type being extended + member ApparentEnclosingEntity: FSharpEntity + /// Get the declaration location of the member, function or value member DeclarationLocation: range @@ -768,9 +771,6 @@ and [] public FSharpMemberOrFunctionOrValue = /// Get the logical name of the member member LogicalName: string - /// Get the logical enclosing entity, which for an extension member is type being extended - member LogicalEnclosingEntity: FSharpEntity - /// Get the name as presented in F# error messages and documentation member DisplayName : string @@ -882,8 +882,8 @@ and [] public FSharpActivePatternGroup = /// Get the type indicating signature of the active pattern member OverallType : FSharpType - /// Try to get the enclosing entity of the active pattern - member EnclosingEntity : FSharpEntity option + /// Try to get the entity in which the active pattern is declared + member DeclaringEntity : FSharpEntity option and [] public FSharpType = diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index 8e5ba69dcd..5912bb1ea3 100755 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -2220,7 +2220,7 @@ and [] // -- LinearizeTopMatch // // The fresh temporary should just be created with the right parent - mutable val_actual_parent: ParentRef + mutable val_declaring_entity: ParentRef /// XML documentation attached to a value. /// MUTABILITY: for unpickle linkage @@ -2294,7 +2294,7 @@ and [] member x.LinkagePartialKey : ValLinkagePartialKey = assert x.IsCompiledAsTopLevel { LogicalName = x.LogicalName - MemberParentMangledName = (if x.IsMember then Some x.MemberApparentParent.LogicalName else None) + MemberParentMangledName = (if x.IsMember then Some x.MemberApparentEntity.LogicalName else None) MemberIsOverride = x.IsOverrideOrExplicitImpl TotalArgCount = if x.IsMember then x.ValReprInfo.Value.TotalArgCount else 0 } @@ -2412,26 +2412,26 @@ and [] and set(v) = x.val_xmldocsig <- v /// The parent type or module, if any (None for expression bindings and parameters) - member x.ActualParent = x.val_actual_parent + member x.DeclaringEntity = x.val_declaring_entity /// Get the actual parent entity for the value (a module or a type), i.e. the entity under which the /// value will appear in compiled code. For extension members this is the module where the extension member /// is declared. - member x.TopValActualParent = - match x.ActualParent with + member x.TopValDeclaringEntity = + match x.DeclaringEntity with | Parent tcref -> tcref - | ParentNone -> error(InternalError("TopValActualParent: does not have a parent",x.Range)) + | ParentNone -> error(InternalError("TopValDeclaringEntity: does not have a parent",x.Range)) - member x.HasTopValActualParent = - match x.ActualParent with + member x.HasDeclaringEntity = + match x.DeclaringEntity with | Parent _ -> true | ParentNone -> false /// Get the apparent parent entity for a member - member x.MemberApparentParent : TyconRef = + member x.MemberApparentEntity : TyconRef = match x.MemberInfo with - | Some membInfo -> membInfo.ApparentParent - | None -> error(InternalError("MemberApparentParent",x.Range)) + | Some membInfo -> membInfo.ApparentEnclosingEntity + | None -> error(InternalError("MemberApparentEntity",x.Range)) /// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'. member v.NumObjArgs = @@ -2442,10 +2442,10 @@ and [] /// Get the apparent parent entity for the value, i.e. the entity under with which the /// value is associated. For extension members this is the nominal type the member extends. /// For other values it is just the actual parent. - member x.ApparentParent = + member x.ApparentEnclosingEntity = match x.MemberInfo with - | Some membInfo -> Parent(membInfo.ApparentParent) - | None -> x.ActualParent + | Some membInfo -> Parent(membInfo.ApparentEnclosingEntity) + | None -> x.DeclaringEntity /// Get the public path to the value, if any? Should be set if and only if /// IsMemberOrModuleBinding is set. @@ -2459,7 +2459,7 @@ and [] // - in ilxgen.fs: as a boolean to detect public values for saving quotations // - in MakeExportRemapping, to build non-local references for values member x.PublicPath = - match x.ActualParent with + match x.DeclaringEntity with | Parent eref -> match eref.PublicPath with | None -> None @@ -2587,7 +2587,7 @@ and [] val_member_info = Unchecked.defaultof<_> val_attribs = Unchecked.defaultof<_> val_repr_info = Unchecked.defaultof<_> - val_actual_parent = Unchecked.defaultof<_> + val_declaring_entity = Unchecked.defaultof<_> val_xmldoc = Unchecked.defaultof<_> val_xmldocsig = Unchecked.defaultof<_> } @@ -2613,7 +2613,7 @@ and [] x.val_member_info <- tg.val_member_info x.val_attribs <- tg.val_attribs x.val_repr_info <- tg.val_repr_info - x.val_actual_parent <- tg.val_actual_parent + x.val_declaring_entity <- tg.val_declaring_entity x.val_xmldoc <- tg.val_xmldoc x.val_xmldocsig <- tg.val_xmldocsig @@ -2627,7 +2627,7 @@ and [] ValMemberInfo = { /// The parent type. For an extension member this is the type being extended - ApparentParent: TyconRef + ApparentEnclosingEntity: TyconRef /// Updated with the full implemented slotsig after interface implementation relation is checked mutable ImplementedSlotSigs: SlotSig list @@ -3240,12 +3240,12 @@ and member x.Accessibility = x.Deref.Accessibility /// The parent type or module, if any (None for expression bindings and parameters) - member x.ActualParent = x.Deref.ActualParent + member x.DeclaringEntity = x.Deref.DeclaringEntity /// Get the apparent parent entity for the value, i.e. the entity under with which the /// value is associated. For extension members this is the nominal type the member extends. /// For other values it is just the actual parent. - member x.ApparentParent = x.Deref.ApparentParent + member x.ApparentEnclosingEntity = x.Deref.ApparentEnclosingEntity member x.DefinitionRange = x.Deref.DefinitionRange @@ -3373,13 +3373,13 @@ and /// Get the actual parent entity for the value (a module or a type), i.e. the entity under which the /// value will appear in compiled code. For extension members this is the module where the extension member /// is declared. - member x.TopValActualParent = x.Deref.TopValActualParent + member x.TopValDeclaringEntity = x.Deref.TopValDeclaringEntity // Can be false for members after error recovery - member x.HasTopValActualParent = x.Deref.HasTopValActualParent + member x.HasDeclaringEntity = x.Deref.HasDeclaringEntity /// Get the apparent parent entity for a member - member x.MemberApparentParent = x.Deref.MemberApparentParent + member x.MemberApparentEntity = x.Deref.MemberApparentEntity /// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'. member x.NumObjArgs = x.Deref.NumObjArgs @@ -4988,7 +4988,7 @@ let NewVal (logicalName:string,m:range,compiledName,ty,isMutable,isCompGen,arity val_other_range=None val_defn=None val_repr_info= arity - val_actual_parent= actualParent + val_declaring_entity= actualParent val_flags = ValFlags(recValInfo,baseOrThis,isCompGen,inlineInfo,isMutable,isModuleOrMemberBinding,isExtensionMember,isIncrClassSpecialMember,isTyFunc,allowTypeInst,isGeneratedEventVal) val_const= konst val_access=access diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 9cdaa6a18f..476c099ebd 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -6967,6 +6967,11 @@ Při čtení metadat jazyka F# sestavení {0} došlo k chybě. Byl použit rezervovaný konstruktor. Je možné, že budete muset upgradovat kompilátor jazyka F# nebo použít dřívější verzi sestavení, ve které se nevyužívá konkrétní konstruktor. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 7c73818288..b29c138b02 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -6967,6 +6967,11 @@ Fehler beim Lesen der F#-Metadaten der Assembly "{0}". Es wurde ein reserviertes Konstrukt verwendet. Möglicherweise müssen Sie Ihren F#-Compiler aktualisieren oder eine frühere Version der Assembly verwenden, die dieses spezielle Konstrukt nicht verwendet. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index 5e6faa804c..9407743447 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -6967,6 +6967,11 @@ An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index f9490c4c92..d8c26154a4 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -6967,6 +6967,11 @@ Se produjo un error al leer los metadatos de F# del ensamblado "{0}". Se utilizó una construcción reservada. Puede que deba actualizar su compilador de F# o usar una versión anterior del ensamblado que no haga uso de una construcción específica. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 1219b7d427..198262498d 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -6967,6 +6967,11 @@ Une erreur s'est produite durant la lecture des métadonnées F# de l'assembly '{0}'. Une construction réservée a été utilisée. Vous devrez peut-être mettre à niveau votre compilateur F# ou utiliser une version antérieure de l'assembly qui ne fait pas appel à une construction spécifique. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 6090bc62dd..dfd630f692 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -6967,6 +6967,11 @@ Si è verificato un errore durante la lettura dei metadati F# dell'assembly '{0}'. È stato utilizzato un costrutto riservato. Potrebbe essere necessario aggiornare il compilatore F# o usare una versione precedente dell'assembly che non usa un costrutto specifico. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 96e27fe596..e2d550f93b 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -6967,6 +6967,11 @@ アセンブリ '{0}' の F# メタデータ の読み取り中にエラーが発生しました。予約済みのコンストラクトが使用されました。F# コンパイラをアップグレードするか、特定のコンストラクトを使用しない以前のバージョンのアセンブリを使用しなければならない場合があります。 + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index f1da0d44ac..db7e9de8df 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -6967,6 +6967,11 @@ '{0}' 어셈블리의 F# 메타데이터를 읽는 동안 오류가 발생했습니다. 예약 구문이 활용되었습니다. F# 컴파일러를 업그레이드하거나 특정 구문을 사용하지 않는 이전 버전의 어셈블리를 사용해야 할 수 있습니다. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 434d400d47..51e36c34c8 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -6967,6 +6967,11 @@ Wystąpił błąd podczas odczytu metadanych języka F# z zestawu „{0}”. Została wykorzystana zarezerwowana konstrukcja. Może być konieczne uaktualnienie kompilatora języka F# lub użycie wcześniejszej wersji zestawu, która nie wykorzystuje określonej konstrukcji. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 683bb23f5a..de3c1d8bc3 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -6967,6 +6967,11 @@ Ocorreu um erro ao ler os metadados F# do assembly '{0}'. Foi utilizada um constructo reservado. Talvez seja necessário atualizar seu compilador F# ou usar uma versão anterior do assembly que não faça uso de um constructo específico. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 0e874b1122..bd4e2fefc1 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -6967,6 +6967,11 @@ Произошла ошибка при чтении метаданных F# сборки "{0}". Использовалась зарезервированная конструкция. Попробуйте обновить компилятор F# или применить более раннюю версию сборки, где конкретная конструкция не используется. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 8f5c3e3e6a..0519a565c1 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -6967,6 +6967,11 @@ '{0}' bütünleştirilmiş kodunun F# meta verileri okunurken bir hata oluştu. Ayrılmış bir yapı kullanıldı. F# derleyicinizi yükseltmeniz veya bütünleştirilmiş kodun belirli bir yapıyı kullanmayan daha eski bir sürümünü kullanmanız gerekebilir. + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 25518d7ef9..9a280a5257 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -6967,6 +6967,11 @@ 读取程序集“{0}”的 F# 元数据时出错。使用了保留的构造。可能需要升级 F# 编译器或使用不用特定构造的较早版本的程序集。 + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index f63b4e2b65..d051d6988f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -6967,6 +6967,11 @@ 讀取組件 '{0}' 的 F# 中繼資料時發生錯誤。已使用保留的建構。建議您升級 F# 編譯器,或使用不會用特定建構的舊版組件。 + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + \ No newline at end of file diff --git a/src/ilx/EraseUnions.fs b/src/ilx/EraseUnions.fs index c75ab90f05..b7f284dbf8 100644 --- a/src/ilx/EraseUnions.fs +++ b/src/ilx/EraseUnions.fs @@ -168,7 +168,7 @@ let cuspecRepr = (fun cuspec -> cuspec.HasHelpers = IlxUnionHasHelpers.SpecialFSharpListHelpers), (fun cuspec -> cuspec.Boxity = ILBoxity.AsValue), (fun (alt:IlxUnionAlternative) -> alt.Name), - (fun cuspec -> cuspec.EnclosingType), + (fun cuspec -> cuspec.DeclaringType), (fun (cuspec,nm) -> mkILNamedTy cuspec.Boxity (mkILTyRefInTyRef (mkCasesTypeRef cuspec, nm)) cuspec.GenericArgs)) type NoTypesGeneratedViaThisReprDecider = NoTypesGeneratedViaThisReprDecider diff --git a/tests/fsharp/core/csext/test.fsx b/tests/fsharp/core/csext/test.fsx index 16a8da62e7..cfe0ec3759 100644 --- a/tests/fsharp/core/csext/test.fsx +++ b/tests/fsharp/core/csext/test.fsx @@ -53,6 +53,266 @@ type Struct(i:int) = static member BlueStruct = blueStruct +#nowarn "3220" + +// See https://github.com/Microsoft/visualfsharp/pull/3729 +module TestsExplicitUseOfTupleProperties = + // all give a warning, suppressed in this file + let x1 = + [ (1,2).Item1 + (1,2).Item2 + (1,2,3).Item1 + (1,2,3).Item2 + (1,2,3).Item3 + (1,2,3,4).Item1 + (1,2,3,4).Item2 + (1,2,3,4).Item3 + (1,2,3,4).Item4 + (1,2,3,4,5).Item1 + (1,2,3,4,5).Item2 + (1,2,3,4,5).Item3 + (1,2,3,4,5).Item4 + (1,2,3,4,5).Item5 + (1,2,3,4,5,6).Item1 + (1,2,3,4,5,6).Item2 + (1,2,3,4,5,6).Item3 + (1,2,3,4,5,6).Item4 + (1,2,3,4,5,6).Item5 + (1,2,3,4,5,6).Item6 + (1,2,3,4,5,6,7).Item1 + (1,2,3,4,5,6,7).Item2 + (1,2,3,4,5,6,7).Item3 + (1,2,3,4,5,6,7).Item4 + (1,2,3,4,5,6,7).Item5 + (1,2,3,4,5,6,7).Item6 + (1,2,3,4,5,6,7).Item7 + (1,2,3,4,5,6,7,8).Item1 + (1,2,3,4,5,6,7,8).Item2 + (1,2,3,4,5,6,7,8).Item3 + (1,2,3,4,5,6,7,8).Item4 + (1,2,3,4,5,6,7,8).Item5 + (1,2,3,4,5,6,7,8).Item6 + (1,2,3,4,5,6,7,8).Item7 + (1,2,3,4,5,6,7,8,9).Item1 + (1,2,3,4,5,6,7,8,9).Item2 + (1,2,3,4,5,6,7,8,9).Item3 + (1,2,3,4,5,6,7,8,9).Item4 + (1,2,3,4,5,6,7,8,9).Item5 + (1,2,3,4,5,6,7,8,9).Item6 + (1,2,3,4,5,6,7,8,9).Item7 + (1,2).get_Item1() + (1,2).get_Item2() + (1,2,3).get_Item1() + (1,2,3).get_Item2() + (1,2,3).get_Item3() + (1,2,3,4).get_Item1() + (1,2,3,4).get_Item2() + (1,2,3,4).get_Item3() + (1,2,3,4).get_Item4() + (1,2,3,4,5).get_Item1() + (1,2,3,4,5).get_Item2() + (1,2,3,4,5).get_Item3() + (1,2,3,4,5).get_Item4() + (1,2,3,4,5).get_Item5() + (1,2,3,4,5,6).get_Item1() + (1,2,3,4,5,6).get_Item2() + (1,2,3,4,5,6).get_Item3() + (1,2,3,4,5,6).get_Item4() + (1,2,3,4,5,6).get_Item5() + (1,2,3,4,5,6).get_Item6() + (1,2,3,4,5,6,7).get_Item1() + (1,2,3,4,5,6,7).get_Item2() + (1,2,3,4,5,6,7).get_Item3() + (1,2,3,4,5,6,7).get_Item4() + (1,2,3,4,5,6,7).get_Item5() + (1,2,3,4,5,6,7).get_Item6() + (1,2,3,4,5,6,7).get_Item7() + (1,2,3,4,5,6,7,8).get_Item1() + (1,2,3,4,5,6,7,8).get_Item2() + (1,2,3,4,5,6,7,8).get_Item3() + (1,2,3,4,5,6,7,8).get_Item4() + (1,2,3,4,5,6,7,8).get_Item5() + (1,2,3,4,5,6,7,8).get_Item6() + (1,2,3,4,5,6,7,8).get_Item7() + (1,2,3,4,5,6,7,8,9).get_Item1() + (1,2,3,4,5,6,7,8,9).get_Item2() + (1,2,3,4,5,6,7,8,9).get_Item3() + (1,2,3,4,5,6,7,8,9).get_Item4() + (1,2,3,4,5,6,7,8,9).get_Item5() + (1,2,3,4,5,6,7,8,9).get_Item6() + (1,2,3,4,5,6,7,8,9).get_Item7() ] + + printfn "x1 = %A" x1 + check "vwhnwrvep01" x1 [1; 2; 1; 2; 3; 1; 2; 3; 4; 1; 2; 3; 4; 5; 1; 2; 3; 4; 5; 6; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; + 1; 2; 1; 2; 3; 1; 2; 3; 4; 1; 2; 3; 4; 5; 1; 2; 3; 4; 5; 6; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7] + + let x2 : System.Tuple = (1,2,3,4,5,6,7,8).Rest // gives a warning, suppressed in this file + printfn "x2 = %A" x2 + check "vwhnwrvep02" x2 (System.Tuple(8)) + + let x3 : (int * int) = (1,2,3,4,5,6,7,8,9).Rest // gives a warning, suppressed in this file + printfn "x3 = %A" x3 + check "vwhnwrvep03" x3 (unbox (box (8,9))) + + // check a quotation of these + let tup = (1,2) + let x4 = <@ tup.Item1 @> + + let text = sprintf "%A" x4 + printfn "%s" text + check "vewjwervwver" text "PropertyGet (Some (PropertyGet (None, tup, [])), Item1, [])" + +(* +// See https://github.com/Microsoft/visualfsharp/pull/3729, struct tuple access to Item* and Rest* are not supported +module TestsExplicitUseOfStructTupleProperties = + // all give a warning, suppressed in this file + let x1 = + [ (struct (1,2)).Item1 + (struct (1,2)).Item2 + (struct (1,2,3)).Item1 + (struct (1,2,3)).Item2 + (struct (1,2,3)).Item3 + (struct (1,2,3,4)).Item1 + (struct (1,2,3,4)).Item2 + (struct (1,2,3,4)).Item3 + (struct (1,2,3,4)).Item4 + (struct (1,2,3,4,5)).Item1 + (struct (1,2,3,4,5)).Item2 + (struct (1,2,3,4,5)).Item3 + (struct (1,2,3,4,5)).Item4 + (struct (1,2,3,4,5)).Item5 + (struct (1,2,3,4,5,6)).Item1 + (struct (1,2,3,4,5,6)).Item2 + (struct (1,2,3,4,5,6)).Item3 + (struct (1,2,3,4,5,6)).Item4 + (struct (1,2,3,4,5,6)).Item5 + (struct (1,2,3,4,5,6)).Item6 + (struct (1,2,3,4,5,6,7)).Item1 + (struct (1,2,3,4,5,6,7)).Item2 + (struct (1,2,3,4,5,6,7)).Item3 + (struct (1,2,3,4,5,6,7)).Item4 + (struct (1,2,3,4,5,6,7)).Item5 + (struct (1,2,3,4,5,6,7)).Item6 + (struct (1,2,3,4,5,6,7)).Item7 + (struct (1,2,3,4,5,6,7,8)).Item1 + (struct (1,2,3,4,5,6,7,8)).Item2 + (struct (1,2,3,4,5,6,7,8)).Item3 + (struct (1,2,3,4,5,6,7,8)).Item4 + (struct (1,2,3,4,5,6,7,8)).Item5 + (struct (1,2,3,4,5,6,7,8)).Item6 + (struct (1,2,3,4,5,6,7,8)).Item7 + (struct (1,2,3,4,5,6,7,8,9)).Item1 + (struct (1,2,3,4,5,6,7,8,9)).Item2 + (struct (1,2,3,4,5,6,7,8,9)).Item3 + (struct (1,2,3,4,5,6,7,8,9)).Item4 + (struct (1,2,3,4,5,6,7,8,9)).Item5 + (struct (1,2,3,4,5,6,7,8,9)).Item6 + (struct (1,2,3,4,5,6,7,8,9)).Item7 + (struct (1,2)).get_Item1() + (struct (1,2)).get_Item2() + (struct (1,2,3)).get_Item1() + (struct (1,2,3)).get_Item2() + (struct (1,2,3)).get_Item3() + (struct (1,2,3,4)).get_Item1() + (struct (1,2,3,4)).get_Item2() + (struct (1,2,3,4)).get_Item3() + (struct (1,2,3,4)).get_Item4() + (struct (1,2,3,4,5)).get_Item1() + (struct (1,2,3,4,5)).get_Item2() + (struct (1,2,3,4,5)).get_Item3() + (struct (1,2,3,4,5)).get_Item4() + (struct (1,2,3,4,5)).get_Item5() + (struct (1,2,3,4,5,6)).get_Item1() + (struct (1,2,3,4,5,6)).get_Item2() + (struct (1,2,3,4,5,6)).get_Item3() + (struct (1,2,3,4,5,6)).get_Item4() + (struct (1,2,3,4,5,6)).get_Item5() + (struct (1,2,3,4,5,6)).get_Item6() + (struct (1,2,3,4,5,6,7)).get_Item1() + (struct (1,2,3,4,5,6,7)).get_Item2() + (struct (1,2,3,4,5,6,7)).get_Item3() + (struct (1,2,3,4,5,6,7)).get_Item4() + (struct (1,2,3,4,5,6,7)).get_Item5() + (struct (1,2,3,4,5,6,7)).get_Item6() + (struct (1,2,3,4,5,6,7)).get_Item7() + (struct (1,2,3,4,5,6,7,8)).get_Item1() + (struct (1,2,3,4,5,6,7,8)).get_Item2() + (struct (1,2,3,4,5,6,7,8)).get_Item3() + (struct (1,2,3,4,5,6,7,8)).get_Item4() + (struct (1,2,3,4,5,6,7,8)).get_Item5() + (struct (1,2,3,4,5,6,7,8)).get_Item6() + (struct (1,2,3,4,5,6,7,8)).get_Item7() + (struct (1,2,3,4,5,6,7,8,9)).get_Item1() + (struct (1,2,3,4,5,6,7,8,9)).get_Item2() + (struct (1,2,3,4,5,6,7,8,9)).get_Item3() + (struct (1,2,3,4,5,6,7,8,9)).get_Item4() + (struct (1,2,3,4,5,6,7,8,9)).get_Item5() + (struct (1,2,3,4,5,6,7,8,9)).get_Item6() + (struct (1,2,3,4,5,6,7,8,9)).get_Item7() ] + + printfn "x1 = %A" x1 + check "vwhnwrvep01" x1 [1; 2; 1; 2; 3; 1; 2; 3; 4; 1; 2; 3; 4; 5; 1; 2; 3; 4; 5; 6; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; + 1; 2; 1; 2; 3; 1; 2; 3; 4; 1; 2; 3; 4; 5; 1; 2; 3; 4; 5; 6; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7; 1; 2; 3; 4; 5; 6; 7] + + let x2 = (struct (1,2,3,4,5,6,7,8)).Rest // gives a warning, suppressed in this file + printfn "x2 = %A" x2 + check "vwhnwrvep02" x2 (System.Tuple(8)) + + let x3 = (struct (1,2,3,4,5,6,7,8,9)).Rest // gives a warning, suppressed in this file + printfn "x3 = %A" x3 + check "vwhnwrvep03" x3 (unbox (box (struct (8,9)))) + + // check a quotation of these + let tup = (struct (1,2)) + let x4 = <@ tup.Item1 @> + + let text = sprintf "%A" x4 + printfn "%s" text + check "vewjwervwver" text "PropertyGet (Some (PropertyGet (None, tup, [])), Item1, [])" +*) + +module TupleCtors = + let t1 x = new System.Tuple<_>(x) + let t2 (x1,x2) = new System.Tuple<_,_>(x1,x2) + let t3 (x1,x2,x3) = new System.Tuple<_,_,_>(x1,x2,x3) + let t4 (x1,x2,x3,x4) = new System.Tuple<_,_,_,_>(x1,x2,x3,x4) + let t5 (x1,x2,x3,x4,x5) = new System.Tuple<_,_,_,_,_>(x1,x2,x3,x4,x5) + let t6 (x1,x2,x3,x4,x5,x6) = new System.Tuple<_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6) + let t7 (x1,x2,x3,x4,x5,x6,x7) = new System.Tuple<_,_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6,x7) + let cp (x1,x2,x3,x4,x5,x6,x7) t = new System.Tuple<_,_,_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6,x7, t) + +module TupleSRTP = + let t1 x = new System.Tuple<_>(x) + let t2 (x1,x2) = new System.Tuple<_,_>(x1,x2) + let t3 (x1,x2,x3) = new System.Tuple<_,_,_>(x1,x2,x3) + let t4 (x1,x2,x3,x4) = new System.Tuple<_,_,_,_>(x1,x2,x3,x4) + let t5 (x1,x2,x3,x4,x5) = new System.Tuple<_,_,_,_,_>(x1,x2,x3,x4,x5) + let t6 (x1,x2,x3,x4,x5,x6) = new System.Tuple<_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6) + let t7 (x1,x2,x3,x4,x5,x6,x7) = new System.Tuple<_,_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6,x7) + let cp (x1,x2,x3,x4,x5,x6,x7) t = new System.Tuple<_,_,_,_,_,_,_,_>(x1,x2,x3,x4,x5,x6,x7, t) + + type T = T with + static member inline ($) (T, t:System.Tuple<_,_,_,_,_,_,_,'rst>) = fun x -> cp (x,t.Item1, t.Item2,t.Item3,t.Item4,t.Item5,t.Item6) ((T $ t.Rest) t.Item7) + static member ($) (T, ()) = fun x -> t1 (x) + static member ($) (T, t:System.Tuple<_>) = fun x -> t2 (x,t.Item1) + static member ($) (T, t:System.Tuple<_,_>) = fun x -> t3 (x,t.Item1, t.Item2) + static member ($) (T, t:System.Tuple<_,_,_>) = fun x -> t4 (x,t.Item1, t.Item2,t.Item3) + static member ($) (T, t:System.Tuple<_,_,_,_>) = fun x -> t5 (x,t.Item1, t.Item2,t.Item3,t.Item4) + static member ($) (T, t:System.Tuple<_,_,_,_,_>) = fun x -> t6 (x,t.Item1, t.Item2,t.Item3,t.Item4,t.Item5) + static member ($) (T, t:System.Tuple<_,_,_,_,_,_>) = fun x -> t7 (x,t.Item1, t.Item2,t.Item3,t.Item4,t.Item5,t.Item6) + static member ($) (T, t:System.Tuple<_,_,_,_,_,_,_>) = fun x -> cp (x,t.Item1, t.Item2,t.Item3,t.Item4,t.Item5,t.Item6) (t1(t.Item7)) + + + let v1 = (^T : (member get_Item1 : unit -> _ ) (new System.Tuple(1,3))) + let v2 = (^T : (member get_Item1 : unit -> _ ) (System.Tuple(1,3))) + let v3 = (^T : (member get_Item1 : unit -> _ ) ((1,3))) + + + + let v1b = (^T : (member get_Item2 : unit -> _ ) (new System.Tuple(1,3))) + let v2b = (^T : (member get_Item2 : unit -> _ ) (System.Tuple(1,3))) + let v3b = (^T : (member get_Item2 : unit -> _ ) ((1,3))) + (*--------------------*) #if TESTS_AS_APP diff --git a/tests/fsharp/core/forwarders/a.cs b/tests/fsharp/core/forwarders/a.cs index 0f6180fe63..0299620719 100644 --- a/tests/fsharp/core/forwarders/a.cs +++ b/tests/fsharp/core/forwarders/a.cs @@ -9,7 +9,7 @@ // 4. From F#, reference both the _split_ DLLs and the original b.dll and the original c.dll // and use a mix of types and functions from a.dll, b.dll and c.dll // -// The aim is to shake out type identity issues assocaited with type forwarders. +// The aim is to shake out type identity issues associated with type forwarders. #if PART1 public class C diff --git a/tests/fsharp/core/members/absil.fsi b/tests/fsharp/core/members/absil.fsi index ed03372264..02c730d0d8 100644 --- a/tests/fsharp/core/members/absil.fsi +++ b/tests/fsharp/core/members/absil.fsi @@ -274,7 +274,7 @@ open System member FormalCallsig: CallSig member ActualReturnType: Type member ActualArgTypes: List - member ActualParent: TypeRef + member DeclaringEntity: TypeRef member ActualCallsig: CallSig member GenericArity: int diff --git a/tests/fsharp/core/members/ops-mutrec/test.fs b/tests/fsharp/core/members/ops-mutrec/test.fs index 1fa82e5c37..a6605a5dba 100644 --- a/tests/fsharp/core/members/ops-mutrec/test.fs +++ b/tests/fsharp/core/members/ops-mutrec/test.fs @@ -121,7 +121,7 @@ module OverloadSamples = type 'a GenericVector with - // Nb. For an operator assocaited with a generic type + // Nb. For an operator associated with a generic type // the the type parameters involved in the operator's definition must be the same // as the type parameters of the enclosing class. static member (+) ((x : 'a GenericVector),(y : 'a GenericVector)) = add x y diff --git a/tests/fsharp/core/members/ops/test.fsx b/tests/fsharp/core/members/ops/test.fsx index d4756db423..677b7f60f8 100644 --- a/tests/fsharp/core/members/ops/test.fsx +++ b/tests/fsharp/core/members/ops/test.fsx @@ -126,7 +126,7 @@ module OverloadSamples = type 'a GenericVector with - // Nb. For an operator assocaited with a generic type + // Nb. For an operator associated with a generic type // the the type parameters involved in the operator's definition must be the same // as the type parameters of the enclosing class. static member (+) ((x : 'a GenericVector),(y : 'a GenericVector)) = add x y diff --git a/tests/fsharp/typecheck/sigs/neg101.bsl b/tests/fsharp/typecheck/sigs/neg101.bsl index 65e8cf1fd4..84e53b5e6a 100644 --- a/tests/fsharp/typecheck/sigs/neg101.bsl +++ b/tests/fsharp/typecheck/sigs/neg101.bsl @@ -1,2 +1,74 @@ -neg101.fs(7,11,7,14): typecheck error FS0039: The field, constructor or member 'Foo' is not defined. \ No newline at end of file +neg101.fs(7,11,7,14): typecheck error FS0039: The field, constructor or member 'Foo' is not defined. + +neg101.fs(14,6,14,17): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(15,6,15,17): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(16,6,16,19): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(17,6,17,19): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(18,6,18,19): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(19,6,19,21): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(20,6,20,21): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(21,6,21,21): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(22,6,22,21): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(23,6,23,23): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(24,6,24,23): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(25,6,25,23): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(26,6,26,23): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(27,6,27,23): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(28,6,28,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(29,6,29,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(30,6,30,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(31,6,31,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(32,6,32,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(33,6,33,25): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(34,6,34,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(35,6,35,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(36,6,36,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(37,6,37,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(38,6,38,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(39,6,39,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(40,6,40,27): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(41,6,41,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(42,6,42,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(43,6,43,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(44,6,44,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(45,6,45,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(46,6,46,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(47,6,47,29): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(49,10,49,32): typecheck error FS3220: This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + +neg101.fs(50,16,50,20): typecheck error FS0039: The field, constructor or member 'Rest' is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg101.fs b/tests/fsharp/typecheck/sigs/neg101.fs index 482d68a2f4..76785bd35a 100644 --- a/tests/fsharp/typecheck/sigs/neg101.fs +++ b/tests/fsharp/typecheck/sigs/neg101.fs @@ -7,3 +7,44 @@ let x: int = 1 let y = x.Foo let f1 z = z.Foo let f2 (z: MyRec) = z.Foo + + +// all give a warning +let x1 = + [ (1,2).Item1 + (1,2).Item2 + (1,2,3).Item1 + (1,2,3).Item2 + (1,2,3).Item3 + (1,2,3,4).Item1 + (1,2,3,4).Item2 + (1,2,3,4).Item3 + (1,2,3,4).Item4 + (1,2,3,4,5).Item1 + (1,2,3,4,5).Item2 + (1,2,3,4,5).Item3 + (1,2,3,4,5).Item4 + (1,2,3,4,5).Item5 + (1,2,3,4,5,6).Item1 + (1,2,3,4,5,6).Item2 + (1,2,3,4,5,6).Item3 + (1,2,3,4,5,6).Item4 + (1,2,3,4,5,6).Item5 + (1,2,3,4,5,6).Item6 + (1,2,3,4,5,6,7).Item1 + (1,2,3,4,5,6,7).Item2 + (1,2,3,4,5,6,7).Item3 + (1,2,3,4,5,6,7).Item4 + (1,2,3,4,5,6,7).Item5 + (1,2,3,4,5,6,7).Item6 + (1,2,3,4,5,6,7).Item7 + (1,2,3,4,5,6,7,8).Item1 + (1,2,3,4,5,6,7,8).Item2 + (1,2,3,4,5,6,7,8).Item3 + (1,2,3,4,5,6,7,8).Item4 + (1,2,3,4,5,6,7,8).Item5 + (1,2,3,4,5,6,7,8).Item6 + (1,2,3,4,5,6,7,8).Item7 ] + +let x2 = (1,2,3,4,5,6,7,8).Rest // gives a warning +let x3 = (1,2).Rest // gives an actual error \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/pos28.fs b/tests/fsharp/typecheck/sigs/pos28.fs index 2fded70c6f..ae383989f4 100644 --- a/tests/fsharp/typecheck/sigs/pos28.fs +++ b/tests/fsharp/typecheck/sigs/pos28.fs @@ -23,3 +23,5 @@ module Test2 = let p1 = &&point.x NativePtr.read p1 + + \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs index 9a89174ac7..49f17817d1 100644 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs +++ b/tests/fsharpqa/Source/Conformance/InferenceProcedures/TypeInference/E_LeftToRightOverloadResolution01.fs @@ -1,6 +1,6 @@ // #Regression #TypeInference // Regression for FSHARP1.0:5749 -// Better error message for overload resolution to help ease pain assocaited with mismatch of intellisense information +// Better error message for overload resolution to help ease pain associated with mismatch of intellisense information let array = [| "Ted"; "Katie"; |] diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensions.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensions.fs index b11f3d396a..f58407e275 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensions.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensions.fs @@ -47,13 +47,13 @@ module UseCSharpExtensionsMethodsWithVariableThisTy = let x3 : DateTime = dateTime1.ExtendGenericUnconstrainedOneArg(dateTime1) let x4 : (int -> int) = func1.ExtendGenericUnconstrainedOneArg(func1) let x5 : (int * int) = tup2.ExtendGenericUnconstrainedOneArg(tup2) - let x6 : int = tup3.Item1() - let x7 : int = tup4.Item1() - let x8 : int = tup5.Item1() - let x9 : int = tup6.Item1() - let x10 : int = tup7.Item1() - let x11 : int = tup8.Item1() - let x12 : int = tup9.Item1() + let x6 : int = tup3.GItem1() + let x7 : int = tup4.GItem1() + let x8 : int = tup5.GItem1() + let x9 : int = tup6.GItem1() + let x10 : int = tup7.GItem1() + let x11 : int = tup8.GItem1() + let x12 : int = tup9.GItem1() let y2 : int list = intList1.ExtendGenericConstrainedNoArg() let y3 : int list = intList1.ExtendGenericConstrainedOneArg(intList2) @@ -84,14 +84,14 @@ module UseFSharpDefinedILExtensionsMethods = type CSharpStyleExtensionMethodsInFSharp () = [] static member ExtendGenericUnconstrainedNoArg(s1: 'T) = s1 [] static member ExtendGenericUnconstrainedOneArg(s1: 'T, s2: 'T) = s1 - [] static member Item1((a,b)) = a - [] static member Item1((a,b,c)) = a - [] static member Item1((a,b,c,d)) = a - [] static member Item1((a,b,c,d,e)) = a - [] static member Item1((a,b,c,d,e,f)) = a - [] static member Item1((a,b,c,d,e,f,g)) = a - [] static member Item1((a,b,c,d,e,f,g,h)) = a - [] static member Item1((a,b,c,d,e,f,g,h,i)) = a + [] static member GItem1((a,b)) = a + [] static member GItem1((a,b,c)) = a + [] static member GItem1((a,b,c,d)) = a + [] static member GItem1((a,b,c,d,e)) = a + [] static member GItem1((a,b,c,d,e,f)) = a + [] static member GItem1((a,b,c,d,e,f,g)) = a + [] static member GItem1((a,b,c,d,e,f,g,h)) = a + [] static member GItem1((a,b,c,d,e,f,g,h,i)) = a [] static member ExtendGenericConstrainedNoArg(s1: 'T when 'T :> System.IComparable) = s1 [] static member ExtendGenericConstrainedOneArg(s1 : 'T, s2 : 'T when 'T :> System.IComparable) = s1 [] static member ExtendGenericConstrainedTightNoArg(s1 : 'T when 'T :> System.IComparable) = s1 @@ -125,13 +125,13 @@ module UseFSharpDefinedILExtensionsMethods = let w2 = s1.ExtendGenericUnconstrainedNoArg() let w3 = ob.ExtendGenericUnconstrainedOneArg(ob) let w4 = s1.ExtendGenericUnconstrainedOneArg(s1) - let w5 = tup2.Item1() - let w6 = tup3.Item1() - let w7 = tup4.Item1() - let w8 = tup5.Item1() - let w9 = tup6.Item1() - let w10 = tup7.Item1() - let w11 = tup8.Item1() + let w5 = tup2.GItem1() + let w6 = tup3.GItem1() + let w7 = tup4.GItem1() + let w8 = tup5.GItem1() + let w9 = tup6.GItem1() + let w10 = tup7.GItem1() + let w11 = tup8.GItem1() let base0 = gclist1.ExtendCollListIgnore(3) let base0b = gclist1.ExtendCollListIgnore(3) @@ -153,13 +153,13 @@ module UseFSharpDefinedILExtensionsMethods = let x3 : DateTime = dateTime1.ExtendGenericUnconstrainedOneArg(dateTime1) let x4 : (int -> int) = func1.ExtendGenericUnconstrainedOneArg(func1) let x5 : (int * int) = tup2.ExtendGenericUnconstrainedOneArg(tup2) - let x6 : int = tup3.Item1() - let x7 : int = tup4.Item1() - let x8 : int = tup5.Item1() - let x9 : int = tup6.Item1() - let x10 : int = tup7.Item1() - let x11 : int = tup8.Item1() - let x12 : int = tup9.Item1() + let x6 : int = tup3.GItem1() + let x7 : int = tup4.GItem1() + let x8 : int = tup5.GItem1() + let x9 : int = tup6.GItem1() + let x10 : int = tup7.GItem1() + let x11 : int = tup8.GItem1() + let x12 : int = tup9.GItem1() let y2 : int list = intList1.ExtendGenericConstrainedNoArg() let y3 : int list = intList1.ExtendGenericConstrainedOneArg(intList2) diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensionsCSLib.cs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensionsCSLib.cs index e1787c9ac6..9d36041ba7 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensionsCSLib.cs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/basic/GenericExtensionsCSLib.cs @@ -36,14 +36,14 @@ static public class C static public T1 ExtendTupleItem1(this Tuple s1) { return s1.Item1; } static public T2 ExtendTupleItem2(this Tuple s1) { return s1.Item2; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple s1) { return s1.Item1; } - static public T1 Item1(this Tuple> s1) { return s1.Item1; } - static public T1 Item1(this Tuple> s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple s1) { return s1.Item1; } + static public T1 GItem1(this Tuple> s1) { return s1.Item1; } + static public T1 GItem1(this Tuple> s1) { return s1.Item1; } /* methods that add extra type parameters not captured by the 'this' argument */ static public U ExtendGenericIgnore(this T s1, U s2) { return s2; } diff --git a/tests/scripts/compiler-perf.fsx b/tests/scripts/compiler-perf.fsx index 86d203bd24..6858d8ffe7 100644 --- a/tests/scripts/compiler-perf.fsx +++ b/tests/scripts/compiler-perf.fsx @@ -23,9 +23,9 @@ nuget FAKE #I "script-packages/packages/FAKE/tools" -#I "script-packages/packages/FSharp.Data/lib/net40" +#I "script-packages/packages/FSharp.Data/lib/net45" #r "script-packages/packages/FAKE/tools/FakeLib.dll" -#r "script-packages/packages/FSharp.Data/lib/net40/FSharp.Data.dll" +#r "script-packages/packages/FSharp.Data/lib/net45/FSharp.Data.dll" open System open System.IO diff --git a/tests/service/CSharpProjectAnalysis.fs b/tests/service/CSharpProjectAnalysis.fs index 2d7ff27ad6..83e2adf51b 100644 --- a/tests/service/CSharpProjectAnalysis.fs +++ b/tests/service/CSharpProjectAnalysis.fs @@ -130,10 +130,10 @@ let _ = CSharpClass(0) |> Async.RunSynchronously |> Seq.map (fun su -> su.Symbol) |> Seq.find (function :? FSharpMemberOrFunctionOrValue as mfv -> mfv.IsConstructor | _ -> false) - match (ctor :?> FSharpMemberOrFunctionOrValue).EnclosingEntity with + match (ctor :?> FSharpMemberOrFunctionOrValue).DeclaringEntity with | Some e -> let members = e.MembersFunctionsAndValues Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsConstructor) members |> should be True Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsEffectivelySameAs ctor) members |> should be True - | None -> failwith "Expected Some for EnclosingEntity" + | None -> failwith "Expected Some for DeclaringEntity" diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index f0207609b2..b81c0d18a5 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -212,8 +212,8 @@ let ``Symbols many tests`` () = fnVal.CurriedParameterGroups.[0].[1].Name.Value |> shouldEqual "y" fnVal.DeclarationLocation.StartLine |> shouldEqual 3 fnVal.DisplayName |> shouldEqual "foo" - fnVal.EnclosingEntity.Value.DisplayName |> shouldEqual "Test" - fnVal.EnclosingEntity.Value.DeclarationLocation.StartLine |> shouldEqual 1 + fnVal.DeclaringEntity.Value.DisplayName |> shouldEqual "Test" + fnVal.DeclaringEntity.Value.DeclarationLocation.StartLine |> shouldEqual 1 fnVal.GenericParameters.Count |> shouldEqual 0 fnVal.InlineAnnotation |> shouldEqual FSharpInlineAnnotation.OptionalInline fnVal.IsActivePattern |> shouldEqual false diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index bf955c5aa6..5eea4c1a6e 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -32,7 +32,7 @@ module internal Utils = | BasicPatterns.Application(f,tyargs,args) -> quote low (printExpr 10 f + printTyargs tyargs + " " + printCurriedArgs args) | BasicPatterns.BaseValue(_) -> "base" | BasicPatterns.Call(Some obj,v,tyargs1,tyargs2,argsL) -> printObjOpt (Some obj) + v.CompiledName + printTyargs tyargs2 + printTupledArgs argsL - | BasicPatterns.Call(None,v,tyargs1,tyargs2,argsL) -> v.EnclosingEntity.Value.CompiledName + printTyargs tyargs1 + "." + v.CompiledName + printTyargs tyargs2 + " " + printTupledArgs argsL + | BasicPatterns.Call(None,v,tyargs1,tyargs2,argsL) -> v.DeclaringEntity.Value.CompiledName + printTyargs tyargs1 + "." + v.CompiledName + printTyargs tyargs2 + " " + printTupledArgs argsL | BasicPatterns.Coerce(ty1,e1) -> quote low (printExpr 10 e1 + " :> " + printTy ty1) | BasicPatterns.DefaultValue(ty1) -> "dflt" | BasicPatterns.FastIntegerForLoop _ -> "for-loop" @@ -45,7 +45,7 @@ module internal Utils = | BasicPatterns.LetRec(vse,b) -> "let rec ... in " + printExpr 0 b | BasicPatterns.NewArray(ty,es) -> "[|" + (es |> Seq.map (printExpr 0) |> String.concat "; ") + "|]" | BasicPatterns.NewDelegate(ty,es) -> "new-delegate" - | BasicPatterns.NewObject(v,tys,args) -> "new " + v.EnclosingEntity.Value.CompiledName + printTupledArgs args + | BasicPatterns.NewObject(v,tys,args) -> "new " + v.DeclaringEntity.Value.CompiledName + printTupledArgs args | BasicPatterns.NewRecord(v,args) -> let fields = v.TypeDefinition.FSharpFields "{" + ((fields, args) ||> Seq.map2 (fun f a -> f.Name + " = " + printExpr 0 a) |> String.concat "; ") + "}" diff --git a/tests/service/MultiProjectAnalysisTests.fs b/tests/service/MultiProjectAnalysisTests.fs index aa38fa5845..1de6ab5475 100644 --- a/tests/service/MultiProjectAnalysisTests.fs +++ b/tests/service/MultiProjectAnalysisTests.fs @@ -233,7 +233,7 @@ let ``Test multi project 1 xmldoc`` () = | _ -> failwith "odd symbol!" match ctorFromProjectMultiProject with - | :? FSharpMemberOrFunctionOrValue as c -> c.EnclosingEntity.Value.XmlDoc.Count |> shouldEqual 1 + | :? FSharpMemberOrFunctionOrValue as c -> c.DeclaringEntity.Value.XmlDoc.Count |> shouldEqual 1 | _ -> failwith "odd symbol!" match case1FromProjectMultiProject with @@ -808,7 +808,7 @@ let ``Test active patterns' XmlDocSig declared in referenced projects`` () = divisibleByGroup.IsTotal |> shouldEqual false divisibleByGroup.Names |> Seq.toList |> shouldEqual ["DivisibleBy"] divisibleByGroup.OverallType.Format(divisibleBySymbolUse.Value.DisplayContext) |> shouldEqual "int -> int -> unit option" - let divisibleByEntity = divisibleByGroup.EnclosingEntity.Value + let divisibleByEntity = divisibleByGroup.DeclaringEntity.Value divisibleByEntity.ToString() |> shouldEqual "Project3A" //------------------------------------------------------------------------------------ diff --git a/tests/service/ProjectAnalysisTests.fs b/tests/service/ProjectAnalysisTests.fs index 93463d6a20..826491c8aa 100644 --- a/tests/service/ProjectAnalysisTests.fs +++ b/tests/service/ProjectAnalysisTests.fs @@ -1550,7 +1550,7 @@ let ``Test complete active patterns' exact ranges from uses of symbols`` () = oddGroup.IsTotal |> shouldEqual true oddGroup.Names |> Seq.toList |> shouldEqual ["Even"; "Odd"] oddGroup.OverallType.Format(oddSymbolUse.Value.DisplayContext) |> shouldEqual "int -> Choice" - let oddEntity = oddGroup.EnclosingEntity.Value + let oddEntity = oddGroup.DeclaringEntity.Value oddEntity.ToString() |> shouldEqual "ActivePatterns" let evenSymbolUse = backgroundTypedParse1.GetSymbolUseAtLocation(10,9,"",["Even"]) |> Async.RunSynchronously @@ -1564,7 +1564,7 @@ let ``Test complete active patterns' exact ranges from uses of symbols`` () = evenGroup.IsTotal |> shouldEqual true evenGroup.Names |> Seq.toList |> shouldEqual ["Even"; "Odd"] evenGroup.OverallType.Format(evenSymbolUse.Value.DisplayContext) |> shouldEqual "int -> Choice" - let evenEntity = evenGroup.EnclosingEntity.Value + let evenEntity = evenGroup.DeclaringEntity.Value evenEntity.ToString() |> shouldEqual "ActivePatterns" let usesOfEvenSymbol = @@ -1608,7 +1608,7 @@ let ``Test partial active patterns' exact ranges from uses of symbols`` () = floatGroup.IsTotal |> shouldEqual false floatGroup.Names |> Seq.toList |> shouldEqual ["Float"] floatGroup.OverallType.Format(floatSymbolUse.Value.DisplayContext) |> shouldEqual "string -> float option" - let evenEntity = floatGroup.EnclosingEntity.Value + let evenEntity = floatGroup.DeclaringEntity.Value evenEntity.ToString() |> shouldEqual "ActivePatterns" let usesOfFloatSymbol = @@ -3251,16 +3251,16 @@ let ``Test Project23 property`` () = extensionProps |> Array.collect (fun f -> [| if f.HasGetterMethod then - yield (f.EnclosingEntity.Value.FullName, f.GetterMethod.CompiledName, f.GetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f) + yield (f.DeclaringEntity.Value.FullName, f.ApparentEnclosingEntity.FullName, f.GetterMethod.CompiledName, f.GetterMethod.DeclaringEntity.Value.FullName, attribsOfSymbol f) if f.HasSetterMethod then - yield (f.EnclosingEntity.Value.FullName, f.SetterMethod.CompiledName, f.SetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f) + yield (f.DeclaringEntity.Value.FullName, f.ApparentEnclosingEntity.FullName, f.SetterMethod.CompiledName, f.SetterMethod.DeclaringEntity.Value.FullName, attribsOfSymbol f) |]) |> Array.toList extensionPropsRelated |> shouldEqual - [("System.Int32", "Int32.get_Zero.Static", "Impl.Getter", + [("Impl.Getter", "System.Int32", "Int32.get_Zero.Static", "Impl.Getter", ["member"; "prop"; "extmem"]); - ("System.Int32", "Int32.get_Value", "Impl.Getter", + ("Impl.Getter", "System.Int32", "Int32.get_Value", "Impl.Getter", ["member"; "prop"; "extmem"])] allSymbolsUses @@ -3297,17 +3297,17 @@ let ``Test Project23 extension properties' getters/setters should refer to the c match x.Symbol with | :? FSharpMemberOrFunctionOrValue as f -> if f.HasGetterMethod then - yield (f.EnclosingEntity.Value.FullName, f.GetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f) + yield (f.DeclaringEntity.Value.FullName, f.GetterMethod.DeclaringEntity.Value.FullName, f.ApparentEnclosingEntity.FullName, f.GetterMethod.ApparentEnclosingEntity.FullName, attribsOfSymbol f) if f.HasSetterMethod then - yield (f.EnclosingEntity.Value.FullName, f.SetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f) + yield (f.DeclaringEntity.Value.FullName, f.SetterMethod.DeclaringEntity.Value.FullName, f.ApparentEnclosingEntity.FullName, f.SetterMethod.ApparentEnclosingEntity.FullName, attribsOfSymbol f) | _ -> () |]) |> Array.toList |> shouldEqual - [ ("System.Int32", "Impl.Setter", ["member"; "prop"; "extmem"]); - ("System.Int32", "Impl.Setter", ["member"; "prop"; "extmem"]); - ("System.Int32", "Impl.Getter", ["member"; "prop"; "extmem"]) - ("System.Int32", "Impl.Getter", ["member"; "prop"; "extmem"]) ] + [ ("Impl.Setter", "Impl.Setter", "System.Int32", "System.Int32", ["member"; "prop"; "extmem"]); + ("Impl.Setter", "Impl.Setter", "System.Int32", "System.Int32", ["member"; "prop"; "extmem"]); + ("Impl.Getter", "Impl.Getter", "System.Int32", "System.Int32", ["member"; "prop"; "extmem"]) + ("Impl.Getter", "Impl.Getter", "System.Int32", "System.Int32", ["member"; "prop"; "extmem"]) ] // Misc - property symbols module internal Project24 = diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpCheckerExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpCheckerExtensions.fs index 14719b17d2..f05b13423d 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpCheckerExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpCheckerExtensions.fs @@ -111,11 +111,11 @@ type FSharpChecker with if func.IsProperty then let fullNames = [| if func.HasGetterMethod then - match func.GetterMethod.EnclosingEntity with + match func.GetterMethod.DeclaringEntity with | Some e -> yield e.TryGetFullName() | None -> () if func.HasSetterMethod then - match func.SetterMethod.EnclosingEntity with + match func.SetterMethod.DeclaringEntity with | Some e -> yield e.TryGetFullName() | None -> () |] @@ -124,7 +124,7 @@ type FSharpChecker with | [||] -> None | _ -> Some fullNames else - match func.EnclosingEntity with + match func.DeclaringEntity with // C# extension method | Some (Symbol.FSharpEntity Symbol.Class) -> let fullName = symbolUse.Symbol.FullName.Split '.' diff --git a/vsintegration/tests/unittests/CompletionProviderTests.fs b/vsintegration/tests/unittests/CompletionProviderTests.fs index 5e0212f62b..718e34b5ba 100644 --- a/vsintegration/tests/unittests/CompletionProviderTests.fs +++ b/vsintegration/tests/unittests/CompletionProviderTests.fs @@ -441,7 +441,7 @@ type List<'a> with List(). """ - let expected = ["Capacity"; "Count"; "ExtensionProp"; "Item"; "Add"; "AddRange"; "AsReadOnly"; "BinarySearch"; "Clear"; "Contains"; "ConvertAll"; "CopyTo"; "Exists" + let expected = ["Capacity"; "Count"; "Item"; "ExtensionProp"; "Add"; "AddRange"; "AsReadOnly"; "BinarySearch"; "Clear"; "Contains"; "ConvertAll"; "CopyTo"; "Exists" "Find"; "FindAll"; "FindIndex"; "FindLast"; "FindLastIndex"; "ForEach"; "GetEnumerator"; "GetRange"; "IndexOf"; "Insert"; "InsertRange"; "LastIndexOf" "Remove"; "RemoveAll"; "RemoveAt"; "RemoveRange"; "Reverse"; "Sort"; "ToArray"; "TrimExcess"; "TrueForAll"; "Equals"; "GetHashCode"; "GetType"; "ToString" "ExtensionMeth"] diff --git a/vsintegration/tests/unittests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/unittests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 7547ba6459..c918cbd3ec 100644 --- a/vsintegration/tests/unittests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/unittests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -772,8 +772,7 @@ type UsingMSBuild() = [] //This test verifies that ParamInfo location on a provided type without the namespace that exposes static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.ParameterInfoLocation.WithOutNamespace`` () = - this.TestParameterInfoLocation("open N1 \n"+ - "type boo = T<$", + this.TestParameterInfoLocation("open N1 \n"+"type boo = T<$", expectedPos = 11, addtlRefAssy = [PathRelativeToTestAssembly(@"UnitTests\MockTypeProviders\DummyProviderForLanguageServiceTesting.dll")]) diff --git a/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj index 0eb67c3286..2bedabfac1 100644 --- a/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/unittests/VisualFSharp.UnitTests.fsproj @@ -59,52 +59,52 @@ - FsUnit.fs + CompilerService\FsUnit.fs - Common.fs + CompilerService\Common.fs - ServiceAnalysis\Symbols.fs + CompilerService\Symbols.fs - EditorTests.fs + CompilerService\EditorTests.fs - FileSystemTests.fs + CompilerService\FileSystemTests.fs - ProjectAnalysisTests.fs + CompilerService\ProjectAnalysisTests.fs - MultiProjectAnalysisTests.fs + CompilerService\MultiProjectAnalysisTests.fs - PerfTests.fs + CompilerService\PerfTests.fs - InteractiveCheckerTests.fs + CompilerService\InteractiveCheckerTests.fs - ExprTests.fs + CompilerService\ExprTests.fs - CSharpProjectAnalysis.fs + CompilerService\CSharpProjectAnalysis.fs - ProjectOptionsTests.fs + CompilerService\ProjectOptionsTests.fs - StructureTests.fs + CompilerService\StructureTests.fs - AssemblyContentProviderTests.fs + CompilerService\AssemblyContentProviderTests.fs - ServiceUntypedParseTests.fs + CompilerService\ServiceUntypedParseTests.fs - ServiceAnalysis\UnusedOpensTests.fs + CompilerService\UnusedOpensTests.fs Roslyn\ColorizationServiceTests.fs From daf9b9ef9b35e3b23d51d500b938b064b392e142 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 23 Jan 2018 00:18:52 +0300 Subject: [PATCH 03/15] Override ToString in FSharpSymbolUse (#4226) * Override ToString in FSharpSymbolUse * Use %O in format string --- src/fsharp/symbols/Symbols.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index b3da397df6..4f8f461beb 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -2312,3 +2312,4 @@ type FSharpSymbolUse(g:TcGlobals, denv: DisplayEnv, symbol:FSharpSymbol, itemOcc member __.Range = Range.toZ range member __.RangeAlternate = range + override __.ToString() = sprintf "%O, %O, %O" symbol itemOcc range From 051fc59993c145adf7e8683e6b647c42d0a11b9d Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Mon, 22 Jan 2018 13:37:37 -0800 Subject: [PATCH 04/15] update loc --- src/fsharp/xlf/FSComp.txt.cs.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.de.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.en.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.es.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.fr.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.it.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ja.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ko.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.pl.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ru.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.tr.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 2935daad73..4c4e74baf4 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Konstruktor členu nebo objektu {0} není {1}. K soukromým členům se dá přistupovat jenom z deklarujícího typu. K chráněným členům se dá přistupovat jenom z rozšiřujícího typu a nedá se k nim přistupovat z vnitřních výrazů lambda. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Konstruktor členu nebo objektu {0} není {1}. K soukromým členům se dá přistupovat jenom z deklarujícího typu. K chráněným členům se dá přistupovat jenom z rozšiřujícího typu a nedá se k nim přistupovat z vnitřních výrazů lambda. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 71ea94d5e1..7038dfa8b9 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Der Member oder Objektkonstruktor "{0}" ist nicht {1}. Auf private Member darf nur innerhalb des deklarierenden Typs zugegriffen werden. Auf geschützte Member darf nur von einem erweiternden Typ zugegriffen werden; der Zugriff von inneren lambda-Ausdrücken ist nicht zulässig. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Der Member oder Objektkonstruktor "{0}" ist nicht {1}. Auf private Member darf nur innerhalb des deklarierenden Typs zugegriffen werden. Auf geschützte Member darf nur von einem erweiternden Typ zugegriffen werden; der Zugriff von inneren lambda-Ausdrücken ist nicht zulässig. diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index ce04f3b707..5e6faa804c 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 4752131b8b..2bd9067a03 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - El constructor de objeto o miembro '{0}' no es {1}. Los miembros privados solo son accesibles desde el tipo que los declara. Los miembros protegidos solo son accesibles desde un tipo de extensión y no son accesibles desde expresiones lambda internas. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + El constructor de objeto o miembro '{0}' no es {1}. Los miembros privados solo son accesibles desde el tipo que los declara. Los miembros protegidos solo son accesibles desde un tipo de extensión y no son accesibles desde expresiones lambda internas. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 4d42b75658..522420e43a 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Le membre ou le constructeur d'objet '{0}' n'est pas {1}. Les membres privés ne peuvent être accessibles qu'à partir du type déclarant. Les membres protégés ne peuvent être accessibles qu'à partir d'un type d'extension et ne sont pas accessibles à partir d'expressions lambda internes. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Le membre ou le constructeur d'objet '{0}' n'est pas {1}. Les membres privés ne peuvent être accessibles qu'à partir du type déclarant. Les membres protégés ne peuvent être accessibles qu'à partir d'un type d'extension et ne sont pas accessibles à partir d'expressions lambda internes. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index fe43f55e80..d3153a4fb8 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Il costruttore di oggetti o membro '{0}' non è {1}. È possibile accedere ai membri privati solo dall'interno del tipo dichiarante. I membri privati sono invece accessibili solo da un tipo di estensione e non da espressioni lambda interne. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Il costruttore di oggetti o membro '{0}' non è {1}. È possibile accedere ai membri privati solo dall'interno del tipo dichiarante. I membri privati sono invece accessibili solo da un tipo di estensione e non da espressioni lambda interne. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index e540822197..7bb7265de6 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - メンバーまたはオブジェクト コンストラクター '{0}' は {1} ではありません。プライベート メンバーには、宣言する型の中からのみアクセスできます。プロテクト メンバーには、拡張する型からのみアクセスでき、内部ラムダ式からアクセスすることはできません。 + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + メンバーまたはオブジェクト コンストラクター '{0}' は {1} ではありません。プライベート メンバーには、宣言する型の中からのみアクセスできます。プロテクト メンバーには、拡張する型からのみアクセスでき、内部ラムダ式からアクセスすることはできません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 94f9cad206..07da6491c7 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - 멤버 또는 개체 생성자 '{0}'은(는) {1}이(가) 아닙니다. 전용 멤버는 선언 형식 내에서만 액세스할 수 있습니다. 보호된 멤버는 확장 형식에서만 액세스할 수 있으며 내부 람다 식에서는 액세스할 수 없습니다. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + 멤버 또는 개체 생성자 '{0}'은(는) {1}이(가) 아닙니다. 전용 멤버는 선언 형식 내에서만 액세스할 수 있습니다. 보호된 멤버는 확장 형식에서만 액세스할 수 있으며 내부 람다 식에서는 액세스할 수 없습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index b00cddd507..b3a4c378ab 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Element członkowski lub konstruktor obiektów „{0}” nie jest {1}. Prywatne elementy członkowskie mogą być dostępne tylko w obrębie typu deklarującego. Chronione elementy członkowskie mogą być dostępne tylko z poziomu typu rozszerzającego. Nie można uzyskać do nich dostępu z poziomu wewnętrznych wyrażeń lambda. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Element członkowski lub konstruktor obiektów „{0}” nie jest {1}. Prywatne elementy członkowskie mogą być dostępne tylko w obrębie typu deklarującego. Chronione elementy członkowskie mogą być dostępne tylko z poziomu typu rozszerzającego. Nie można uzyskać do nich dostępu z poziomu wewnętrznych wyrażeń lambda. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 5e5ac9d57d..828525cf3f 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - O construtor de membro ou objeto '{0}' não é {1}. Membros particulares só podem ser acessados no tipo de declaração. Membros protegidos só podem ser acessados em um tipo de extensão e não podem ser acessados em expressões lambda internas. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + O construtor de membro ou objeto '{0}' não é {1}. Membros particulares só podem ser acessados no tipo de declaração. Membros protegidos só podem ser acessados em um tipo de extensão e não podem ser acessados em expressões lambda internas. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index d39d24730b..f9f4daccc8 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Конструктор элемента или объекта "{0}" не является {1}. Закрытые элементы доступны только внутри типа, в котором они объявляются. Защищенные типы доступны только из расширяющего типа и недоступны из внутренних лямбда-выражений. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Конструктор элемента или объекта "{0}" не является {1}. Закрытые элементы доступны только внутри типа, в котором они объявляются. Защищенные типы доступны только из расширяющего типа и недоступны из внутренних лямбда-выражений. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 80d679464b..cc8650f721 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - Üye veya nesne oluşturucu '{0}', {1} değil. Özel üyelere yalnızca tanımlayan türün içinden erişilebilir. Korunan üyelere yalnızca genişletilen bir türden erişilebilir, iç lambda ifadelerinden erişilemez. + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + Üye veya nesne oluşturucu '{0}', {1} değil. Özel üyelere yalnızca tanımlayan türün içinden erişilebilir. Korunan üyelere yalnızca genişletilen bir türden erişilebilir, iç lambda ifadelerinden erişilemez. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index e42ee01bb0..bf1aec7f64 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - 成员或对象构造函数“{0}”不是 {1}。只可以从声明类型中访问私有成员。只可以从扩展类型访问受保护的成员,而不能从内部 lambda 表达式访问这些成员。 + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + 成员或对象构造函数“{0}”不是 {1}。只可以从声明类型中访问私有成员。只可以从扩展类型访问受保护的成员,而不能从内部 lambda 表达式访问这些成员。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 5f8dcb8209..f81f5698f8 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -1668,8 +1668,8 @@ - The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it. - 成員或物件建構函式 '{0}' 不是 {1}。私用成員只能從宣告類型中存取。受保護的成員只能從擴充類型存取,無法從內部 Lambda 運算式存取。 + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + 成員或物件建構函式 '{0}' 不是 {1}。私用成員只能從宣告類型中存取。受保護的成員只能從擴充類型存取,無法從內部 Lambda 運算式存取。 From 6cb64f294f54ddc7e9040fa0db245aad37b3095e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 23 Jan 2018 10:45:56 -0800 Subject: [PATCH 05/15] Add support for easy DesignTime Assembly Packing (#4239) * Enable pack for type providers * Add support to msbuild simplify to pack for typeprovider packages * Add transitive dependencies --- .../Microsoft.FSharp.NetSdk.targets | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets index ceb5be0494..c8f72b909a 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets @@ -73,4 +73,31 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and + + $(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools + + + + + fsharp41 + tools + + + + + + + <_ResolvedProjectOutputFiles + Include="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/*" + Exclude="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/FSharp.Core.dll;%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/System.ValueTuple.dll" + Condition="'%(_ResolvedProjectReferencePaths.IsFSharpDesignTimeProvider)' == 'true'"> + %(_ResolvedProjectReferencePaths.NearestTargetFramework) + + + + $(FSharpToolsDirectory)/$(FSharpDesignTimeProtocol)/%(_ResolvedProjectOutputFiles.NearestTargetFramework)/%(_ResolvedProjectOutputFiles.FileName)%(_ResolvedProjectOutputFiles.Extension) + + + + From 488e71c400218a0246d9766c263895e0b52c4182 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 24 Jan 2018 08:25:14 +0100 Subject: [PATCH 06/15] It looks like we can get rid of some Some (#4244) --- src/fsharp/TypeChecker.fs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index fda1dbda1a..e21dcc9c45 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -793,8 +793,8 @@ let UnifyFunctionType extraInfo cenv denv mFunExpr ty = | None -> error (FunctionExpected(denv, ty, mFunExpr)) let ReportImplicitlyIgnoredBoolExpression denv m ty expr = - let checkExpr m exprOpt = - match exprOpt with + let checkExpr m expr = + match expr with | Expr.App(Expr.Val(vf, _, _), _, _, exprs, _) when vf.LogicalName = opNameEquals -> match exprs with | Expr.App(Expr.Val(propRef, _, _), _, _, Expr.Val(vf, _, _) :: _, _) :: _ -> @@ -821,17 +821,16 @@ let ReportImplicitlyIgnoredBoolExpression denv m ty expr = | _ -> UnitTypeExpected (denv, ty, m) match expr with - | Some(Expr.Let(_, Expr.Sequential(_, inner, _, _, _), _, _)) - | Some(Expr.Sequential(_, inner, _, _, _)) -> + | Expr.Let(_, Expr.Sequential(_, inner, _, _, _), _, _) + | Expr.Sequential(_, inner, _, _, _) -> let rec extractNext expr = match expr with | Expr.Sequential(_, inner, _, _, _) -> extractNext inner | _ -> checkExpr expr.Range expr extractNext inner - | Some expr -> checkExpr m expr - | _ -> UnitTypeExpected (denv, ty, m) + | expr -> checkExpr m expr -let UnifyUnitType cenv denv m ty exprOpt = +let UnifyUnitType cenv denv m ty expr = if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty cenv.g.unit_ty then true else @@ -843,7 +842,7 @@ let UnifyUnitType cenv denv m ty exprOpt = if not (typeEquiv cenv.g cenv.g.bool_ty ty) then warning (UnitTypeExpected (denv, ty, m)) else - warning (ReportImplicitlyIgnoredBoolExpression denv m ty exprOpt) + warning (ReportImplicitlyIgnoredBoolExpression denv m ty expr) false //------------------------------------------------------------------------- @@ -5568,7 +5567,7 @@ and TcStmtThatCantBeCtorBody cenv env tpenv expr = and TcStmt cenv env tpenv synExpr = let expr, ty, tpenv = TcExprOfUnknownType cenv env tpenv synExpr let m = synExpr.Range - let wasUnit = UnifyUnitType cenv env.DisplayEnv m ty (Some expr) + let wasUnit = UnifyUnitType cenv env.DisplayEnv m ty expr if wasUnit then expr, tpenv else @@ -10414,7 +10413,7 @@ and TcNormalizedBinding declKind (cenv:cenv) env tpenv overallTy safeThisValOpt else TcExprThatCantBeCtorBody cenv overallExprTy envinner tpenv rhsExpr) if bkind = StandaloneExpression && not cenv.isScript then - UnifyUnitType cenv env.DisplayEnv mBinding overallPatTy (Some rhsExprChecked) |> ignore + UnifyUnitType cenv env.DisplayEnv mBinding overallPatTy rhsExprChecked |> ignore // Fix up the r.h.s. expression for 'fixed' let rhsExprChecked = From 203d70e820fbcaa84d9de254bbeb79c24c8f9e18 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 24 Jan 2018 07:34:04 +0000 Subject: [PATCH 07/15] show type of ignored expression (#4197) * show type of ignored expression * fix tests * fix tests * fix test --- src/fsharp/CompileOps.fs | 36 ++++++++++--------- src/fsharp/FSStrings.resx | 10 +++--- src/fsharp/service/service.fs | 4 +++ src/fsharp/xlf/FSStrings.cs.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.de.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.en.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.es.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.fr.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.it.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.ja.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.ko.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.pl.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.pt-BR.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.ru.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.tr.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.zh-Hans.xlf | 20 +++++------ src/fsharp/xlf/FSStrings.zh-Hant.xlf | 20 +++++------ .../Basic/W_DoBindingsNotUnit01.fs | 2 +- .../BindingExpressions/Binding/in01.fs | 2 +- .../BindingExpressions/Binding/in02.fs | 2 +- .../BindingExpressions/Binding/in03.fs | 2 +- .../BindingExpressions/Binding/in04.fs | 2 +- .../BindingExpressions/Binding/in05.fs | 2 +- .../TryFinally/W-TryFinallyNotUnit.fs | 2 +- .../Named/E_ActivePatternUnconstrained01.fs | 2 +- .../Diagnostics/General/W_Multiline02.fs | 2 +- .../Source/Diagnostics/NONTERM/quoteExpr01.fs | 2 +- .../Source/Diagnostics/async/MissingIgnore.fs | 2 +- .../async/MissingReturnBangForLoop01.fs | 2 +- .../async/MissingReturnBangForLoop02.fs | 2 +- .../async/MissingReturnBangForLoop03.fs | 2 +- .../async/MissingReturnBangForLoop04.fs | 2 +- tests/fsharpqa/Source/Misc/Parsing02.fs | 4 +-- .../DontWarnIfPropertyWithoutSetter.fs | 2 +- .../Warnings/WarnIfExpressionResultUnused.fs | 2 +- .../Warnings/WarnIfImplicitlyDiscarded.fs | 2 +- .../Warnings/WarnOnlyOnLastExpression.fs | 2 +- 37 files changed, 190 insertions(+), 182 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index d95a68a394..736c097a54 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -532,11 +532,11 @@ let UseOfAddressOfOperatorE() = DeclareResourceString("UseOfAddressOfOperator", let DefensiveCopyWarningE() = DeclareResourceString("DefensiveCopyWarning", "%s") let DeprecatedThreadStaticBindingWarningE() = DeclareResourceString("DeprecatedThreadStaticBindingWarning", "") let FunctionValueUnexpectedE() = DeclareResourceString("FunctionValueUnexpected", "%s") -let UnitTypeExpectedE() = DeclareResourceString("UnitTypeExpected", "") -let UnitTypeExpectedWithEqualityE() = DeclareResourceString("UnitTypeExpectedWithEquality", "") -let UnitTypeExpectedWithPossiblePropertySetterE() = DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter", "%s%s") -let UnitTypeExpectedWithPossibleAssignmentE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignment", "%s") -let UnitTypeExpectedWithPossibleAssignmentToMutableE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable", "%s") +let UnitTypeExpectedE() = DeclareResourceString("UnitTypeExpected", "%s") +let UnitTypeExpectedWithEqualityE() = DeclareResourceString("UnitTypeExpectedWithEquality", "%s") +let UnitTypeExpectedWithPossiblePropertySetterE() = DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter", "%s%s%s") +let UnitTypeExpectedWithPossibleAssignmentE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignment", "%s%s") +let UnitTypeExpectedWithPossibleAssignmentToMutableE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable", "%s%s") let RecursiveUseCheckedAtRuntimeE() = DeclareResourceString("RecursiveUseCheckedAtRuntime", "") let LetRecUnsound1E() = DeclareResourceString("LetRecUnsound1", "%s") let LetRecUnsound2E() = DeclareResourceString("LetRecUnsound2", "%s%s") @@ -1292,28 +1292,32 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) = os.Append(DeprecatedThreadStaticBindingWarningE().Format) |> ignore | FunctionValueUnexpected (denv, ty, _) -> - // REVIEW: consider if we need to show _cxs (the type parameter constraints) let ty, _cxs = PrettyTypes.PrettifyType denv.g ty - os.Append(FunctionValueUnexpectedE().Format (NicePrint.stringOfTy denv ty)) |> ignore + let errorText = FunctionValueUnexpectedE().Format (NicePrint.stringOfTy denv ty) + os.Append errorText |> ignore - | UnitTypeExpected (_, _, _) -> - let warningText = UnitTypeExpectedE().Format + | UnitTypeExpected (denv, ty, _) -> + let ty, _cxs = PrettyTypes.PrettifyType denv.g ty + let warningText = UnitTypeExpectedE().Format (NicePrint.stringOfTy denv ty) os.Append warningText |> ignore - | UnitTypeExpectedWithEquality (_) -> - let warningText = UnitTypeExpectedWithEqualityE().Format + | UnitTypeExpectedWithEquality (denv, ty, _) -> + let ty, _cxs = PrettyTypes.PrettifyType denv.g ty + let warningText = UnitTypeExpectedWithEqualityE().Format (NicePrint.stringOfTy denv ty) os.Append warningText |> ignore - | UnitTypeExpectedWithPossiblePropertySetter (_, _, bindingName, propertyName, _) -> - let warningText = UnitTypeExpectedWithPossiblePropertySetterE().Format bindingName propertyName + | UnitTypeExpectedWithPossiblePropertySetter (denv, ty, bindingName, propertyName, _) -> + let ty, _cxs = PrettyTypes.PrettifyType denv.g ty + let warningText = UnitTypeExpectedWithPossiblePropertySetterE().Format (NicePrint.stringOfTy denv ty) bindingName propertyName os.Append warningText |> ignore - | UnitTypeExpectedWithPossibleAssignment (_, _, isAlreadyMutable, bindingName, _) -> + | UnitTypeExpectedWithPossibleAssignment (denv, ty, isAlreadyMutable, bindingName, _) -> + let ty, _cxs = PrettyTypes.PrettifyType denv.g ty let warningText = if isAlreadyMutable then - UnitTypeExpectedWithPossibleAssignmentToMutableE().Format bindingName + UnitTypeExpectedWithPossibleAssignmentToMutableE().Format (NicePrint.stringOfTy denv ty) bindingName else - UnitTypeExpectedWithPossibleAssignmentE().Format bindingName + UnitTypeExpectedWithPossibleAssignmentE().Format (NicePrint.stringOfTy denv ty) bindingName os.Append warningText |> ignore | RecursiveUseCheckedAtRuntime _ -> diff --git a/src/fsharp/FSStrings.resx b/src/fsharp/FSStrings.resx index 29df23d229..eb8a8f975c 100644 --- a/src/fsharp/FSStrings.resx +++ b/src/fsharp/FSStrings.resx @@ -886,19 +886,19 @@ This expression is a function value, i.e. is missing arguments. Its type is {0}. - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index a2561d73fb..9867372c90 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1519,6 +1519,10 @@ module internal Parser = if source.Length = 0 || not (source.[source.Length - 1] = '\n') then source + "\n" else source let matchBraces(source, fileName, options: FSharpParsingOptions, userOpName: string) = + let delayedLogger = CapturingErrorLogger("matchBraces") + use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> delayedLogger) + use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse + Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "matchBraces", fileName) // Make sure there is an ErrorLogger installed whenever we do stuff that might record errors, even if we ultimately ignore the errors diff --git a/src/fsharp/xlf/FSStrings.cs.xlf b/src/fsharp/xlf/FSStrings.cs.xlf index 595a0422f5..e84aa9c78b 100644 --- a/src/fsharp/xlf/FSStrings.cs.xlf +++ b/src/fsharp/xlf/FSStrings.cs.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Výsledek tohoto výrazu se implicitně ignoruje. Zvažte možnost použít ignore, aby se tato hodnota explicitně zahodila, třeba expr |> ignore, nebo let, aby se výsledek svázal s názvem, třeba let result = expr. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Výsledek tohoto výrazu se implicitně ignoruje. Zvažte možnost použít ignore, aby se tato hodnota explicitně zahodila, třeba expr |> ignore, nebo let, aby se výsledek svázal s názvem, třeba let result = expr. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli nastavit hodnotu na vlastnost, použijte operátor <-, např. {0}.{1} <- výraz. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli nastavit hodnotu na vlastnost, použijte operátor <-, např. {1}.{2} <- výraz. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, označte hodnotu jako mutable a použijte operátor <-, např. {0} <- výraz. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, označte hodnotu jako mutable a použijte operátor <-, např. {1} <- výraz. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, použijte operátor <-, např. {0} <- výraz. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, použijte operátor <-, např. {1} <- výraz. diff --git a/src/fsharp/xlf/FSStrings.de.xlf b/src/fsharp/xlf/FSStrings.de.xlf index 7a94ebe9e1..fc72b3d604 100644 --- a/src/fsharp/xlf/FSStrings.de.xlf +++ b/src/fsharp/xlf/FSStrings.de.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Das Ergebnis dieses Ausdrucks wird implizit ignoriert. Verwenden Sie ggf. "ignore", um diesen Wert explizit zu verwerfen, z. B. "expr |> ignore" oder "let" zum Binden des Ergebnisses an einen Namen, z. B. "let result = expr". + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Das Ergebnis dieses Ausdrucks wird implizit ignoriert. Verwenden Sie ggf. "ignore", um diesen Wert explizit zu verwerfen, z. B. "expr |> ignore" oder "let" zum Binden des Ergebnisses an einen Namen, z. B. "let result = expr". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert auf eine Eigenschaft festlegen möchten, verwenden Sie den Operator "<-". Beispiel: "{0}.{1} <- Ausdruck". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert auf eine Eigenschaft festlegen möchten, verwenden Sie den Operator "<-". Beispiel: "{1}.{2} <- Ausdruck". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert mutieren möchten, markieren Sie ihn als "mutable", und verwenden Sie den Operator "<-". Beispiel: "{0} <- Ausdruck". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert mutieren möchten, markieren Sie ihn als "mutable", und verwenden Sie den Operator "<-". Beispiel: "{1} <- Ausdruck". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert mutieren möchten, verwenden Sie den Operator "<-". Beispiel: "{0} <- Ausdruck". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Das Ergebnis dieses Gleichheitsausdrucks wird implizit verworfen. Verwenden Sie ggf. "let", um das Ergebnis an einen Namen zu binden. Beispiel: "let Ergebnis = Ausdruck". Falls Sie einen Wert mutieren möchten, verwenden Sie den Operator "<-". Beispiel: "{1} <- Ausdruck". diff --git a/src/fsharp/xlf/FSStrings.en.xlf b/src/fsharp/xlf/FSStrings.en.xlf index 45e76d2e30..03bc088774 100644 --- a/src/fsharp/xlf/FSStrings.en.xlf +++ b/src/fsharp/xlf/FSStrings.en.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. diff --git a/src/fsharp/xlf/FSStrings.es.xlf b/src/fsharp/xlf/FSStrings.es.xlf index 9bb6ba04bf..f5c15a1ae4 100644 --- a/src/fsharp/xlf/FSStrings.es.xlf +++ b/src/fsharp/xlf/FSStrings.es.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Implícitamente se omite el resultado de esta expresión. Considere el uso de 'ignore' para descartar este valor explícitamente, por ejemplo, 'expr |> ignore' o 'let' para vincular el resultado a un nombre, por ejemplo, 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Implícitamente se omite el resultado de esta expresión. Considere el uso de 'ignore' para descartar este valor explícitamente, por ejemplo, 'expr |> ignore' o 'let' para vincular el resultado a un nombre, por ejemplo, 'let result = expr'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea establecer un valor en una propiedad, use el operador "<-". Por ejemplo: "{0}.{1} <- expresión". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea establecer un valor en una propiedad, use el operador "<-". Por ejemplo: "{1}.{2} <- expresión". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea mutar un valor, marque el valor como "mutable" y use el operador "<-". Por ejemplo: "{0} <- expresión". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea mutar un valor, marque el valor como "mutable" y use el operador "<-". Por ejemplo: "{1} <- expresión". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea mutar un valor, use el operador "<-". Por ejemplo: "{0} <- expresión". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + El resultado de esta expresión de igualdad se descarta de forma implícita. Considere la posibilidad de usar "let" para enlazar el resultado a un nombre, por ejemplo "let resultado = expresión". Si desea mutar un valor, use el operador "<-". Por ejemplo: "{1} <- expresión". diff --git a/src/fsharp/xlf/FSStrings.fr.xlf b/src/fsharp/xlf/FSStrings.fr.xlf index b3046795b1..76eaa6a443 100644 --- a/src/fsharp/xlf/FSStrings.fr.xlf +++ b/src/fsharp/xlf/FSStrings.fr.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Le résultat de cette expression est ignoré implicitement. Songez à utiliser 'ignore' pour abandonner explicitement cette valeur (par exemple, 'expr |> ignore') ou 'let' pour lier le résultat à un nom (par exemple, 'let result = expr'). + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Le résultat de cette expression est ignoré implicitement. Songez à utiliser 'ignore' pour abandonner explicitement cette valeur (par exemple, 'expr |> ignore') ou 'let' pour lier le résultat à un nom (par exemple, 'let result = expr'). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez définir une valeur sur une propriété, utilisez l'opérateur '<-', par ex., '{0}.{1} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez définir une valeur sur une propriété, utilisez l'opérateur '<-', par ex., '{1}.{2} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez muter une valeur, marquez la valeur avec 'mutable' et utilisez l'opérateur '<-', par ex., '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez muter une valeur, marquez la valeur avec 'mutable' et utilisez l'opérateur '<-', par ex., '{1} <- expression'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez muter une valeur, utilisez l'opérateur '<-', par ex., '{0} <- expression'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Le résultat de cette expression d'égalité est implicitement ignoré. Utilisez 'let' pour lier le résultat à un nom, par ex., 'let result = expression'. Si vous voulez muter une valeur, utilisez l'opérateur '<-', par ex., '{1} <- expression'. diff --git a/src/fsharp/xlf/FSStrings.it.xlf b/src/fsharp/xlf/FSStrings.it.xlf index 2918a10093..b4e40e20a0 100644 --- a/src/fsharp/xlf/FSStrings.it.xlf +++ b/src/fsharp/xlf/FSStrings.it.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Il risultato di questa espressione viene ignorato in modo implicito. Provare a usare 'ignore' per rimuovere esplicitamente questo valore, ad esempio 'expr |> ignore', oppure 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Il risultato di questa espressione viene ignorato in modo implicito. Provare a usare 'ignore' per rimuovere esplicitamente questo valore, ad esempio 'expr |> ignore', oppure 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = expr'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende impostare un valore su una proprietà, usare l'operatore '<-', ad esempio '{0}.{1} <- espressione'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende impostare un valore su una proprietà, usare l'operatore '<-', ad esempio '{0}.{1} <- espressione'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende modificare un valore, contrassegnare il valore 'mutable' e usare l'operatore '<-', ad esempio '{0} <- espressione'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende modificare un valore, contrassegnare il valore 'mutable' e usare l'operatore '<-', ad esempio '{0} <- espressione'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende modificare un valore, usare l'operatore '<-', ad esempio '{0} <- espressione'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Il risultato di questa espressione di uguaglianza viene rimosso in modo implicito. Provare a usare 'let' per eseguire il binding del risultato a un nome, ad esempio 'let result = espressione'. Se si intende modificare un valore, usare l'operatore '<-', ad esempio '{0} <- espressione'. diff --git a/src/fsharp/xlf/FSStrings.ja.xlf b/src/fsharp/xlf/FSStrings.ja.xlf index ed6e8e4662..8a78c60328 100644 --- a/src/fsharp/xlf/FSStrings.ja.xlf +++ b/src/fsharp/xlf/FSStrings.ja.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - この式の結果は暗黙に無視されます。'expr |> ignore' のように 'ignore' を使用してこの値を明示的に破棄するか、'let result = expr' のように 'let' を使用して結果を名前にバインドすることをご考慮ください。 + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + この式の結果は暗黙に無視されます。'expr |> ignore' のように 'ignore' を使用してこの値を明示的に破棄するか、'let result = expr' のように 'let' を使用して結果を名前にバインドすることをご考慮ください。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値をプロパティに設定する場合は、'<-' 演算子を使用します。例: '{0}.{1} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値をプロパティに設定する場合は、'<-' 演算子を使用します。例: '{1}.{2} <- expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値を変換する場合は、値 'mutable' をマークして、'<-' 演算子を使用します。例: '{0} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値を変換する場合は、値 'mutable' をマークして、'<-' 演算子を使用します。例: '{1} <- expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値を変換する場合は、'<-' 演算子を使用します。例: '{0} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + この等式の結果は暗黙的に破棄されます。'let' を使用して結果を名前にバインドすることを検討してください。例: 'let result = expression'。値を変換する場合は、'<-' 演算子を使用します。例: '{1} <- expression'。 diff --git a/src/fsharp/xlf/FSStrings.ko.xlf b/src/fsharp/xlf/FSStrings.ko.xlf index b711404605..484a96b186 100644 --- a/src/fsharp/xlf/FSStrings.ko.xlf +++ b/src/fsharp/xlf/FSStrings.ko.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - 이 식의 결과는 암시적으로 무시됩니다. 'ignore'를 사용하여 이 값을 명시적으로 버리거나(예: 'expr |> ignore'), 'let'을 사용하여 결과를 이름에 바인딩하세요(예: 'let result = expr'). + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + 이 식의 결과는 암시적으로 무시됩니다. 'ignore'를 사용하여 이 값을 명시적으로 버리거나(예: 'expr |> ignore'), 'let'을 사용하여 결과를 이름에 바인딩하세요(예: 'let result = expr'). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 속성으로 설정하려면 '<-' 연산자를 사용하세요(예: '{0}.{1} <- expression'). + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 속성으로 설정하려면 '<-' 연산자를 사용하세요(예: '{1}.{2} <- expression'). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 변경하려면 값을 'mutable'로 표시하고 '<-' 연산자를 사용하세요(예: '{0} <- expression'). + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 변경하려면 값을 'mutable'로 표시하고 '<-' 연산자를 사용하세요(예: '{1} <- expression'). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 변경하려면 '<-' 연산자를 사용하세요(예: '{0} <- expression'). + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + 이 같음 식의 결과가 암시적으로 삭제됩니다. 결과를 이름에 바인딩하려면 'let'을 사용하세요(예: 'let result = expression'). 값을 변경하려면 '<-' 연산자를 사용하세요(예: '{1} <- expression'). diff --git a/src/fsharp/xlf/FSStrings.pl.xlf b/src/fsharp/xlf/FSStrings.pl.xlf index 567512b1a9..d040e26887 100644 --- a/src/fsharp/xlf/FSStrings.pl.xlf +++ b/src/fsharp/xlf/FSStrings.pl.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Wynik tego wyrażenia jest niejawnie ignorowany. Rozważ użycie elementu „ignore”, aby niejawnie odrzucić tę wartość (np. „expr |> ignore”), lub elementu „let”, aby powiązać wynik z nazwą (np. „let result = expr”). + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Wynik tego wyrażenia jest niejawnie ignorowany. Rozważ użycie elementu „ignore”, aby niejawnie odrzucić tę wartość (np. „expr |> ignore”), lub elementu „let”, aby powiązać wynik z nazwą (np. „let result = expr”). - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz ustawić wartość właściwości, użyj operatora „<-”, np. „{0}.{1} <- wyrażenie”. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz ustawić wartość właściwości, użyj operatora „<-”, np. „{1}.{2} <- wyrażenie”. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz zmutować wartość, oznacz ją za pomocą deklaratora „mutable” i użyj operatora „<-”, np. „{0} <- wyrażenie”. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz zmutować wartość, oznacz ją za pomocą deklaratora „mutable” i użyj operatora „<-”, np. „{1} <- wyrażenie”. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz zmutować wartość, użyj operatora „<-”, np. „{0} <- wyrażenie”. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Wynik tego wyrażenia równości jest niejawnie odrzucany. Rozważ użycie słowa kluczowego „let” do powiązania wyniku z nazwą, np. „let wynik = wyrażenie”. Jeśli chcesz zmutować wartość, użyj operatora „<-”, np. „{1} <- wyrażenie”. diff --git a/src/fsharp/xlf/FSStrings.pt-BR.xlf b/src/fsharp/xlf/FSStrings.pt-BR.xlf index 1e53365bf7..6890e26017 100644 --- a/src/fsharp/xlf/FSStrings.pt-BR.xlf +++ b/src/fsharp/xlf/FSStrings.pt-BR.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - O resultado dessa expressão é ignorado implicitamente. Considere usar 'ignore' para descartar esse valor explicitamente, por exemplo, 'expr |> ignore' ou 'let' para associar o resultado a um nome, por exemplo, 'let result = expr'. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + O resultado dessa expressão é ignorado implicitamente. Considere usar 'ignore' para descartar esse valor explicitamente, por exemplo, 'expr |> ignore' ou 'let' para associar o resultado a um nome, por exemplo, 'let result = expr'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende definir um valor de uma propriedade, use o operador '<-', por exemplo, '{0}.{1} <- expressão'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende definir um valor de uma propriedade, use o operador '<-', por exemplo, '{1}.{2} <- expressão'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende alterar um valor, marque-o como 'mutable' e use o operador '<-', por exemplo, '{0} <-expressão'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende alterar um valor, marque-o como 'mutable' e use o operador '<-', por exemplo, '{1} <-expressão'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende alterar um valor, use o operador '<-', por exemplo, '{0} <- expressão'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + O resultado dessa expressão de igualdade é implicitamente descartado. Considere o uso de 'let' para associar o resultado a um nome, por exemplo, 'let resultado = expressão'. Se você pretende alterar um valor, use o operador '<-', por exemplo, '{1} <- expressão'. diff --git a/src/fsharp/xlf/FSStrings.ru.xlf b/src/fsharp/xlf/FSStrings.ru.xlf index d9d8539a80..65d6e20329 100644 --- a/src/fsharp/xlf/FSStrings.ru.xlf +++ b/src/fsharp/xlf/FSStrings.ru.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Результат этого выражения неявно игнорируется. Рассмотрите использование здесь "ignore", чтобы отбросить это значение явным образом, например "expr |> ignore", или же "let", чтобы привязать результат к имени, например "let result = expr". + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Результат этого выражения неявно игнорируется. Рассмотрите использование здесь "ignore", чтобы отбросить это значение явным образом, например "expr |> ignore", или же "let", чтобы привязать результат к имени, например "let result = expr". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались присваивать значение свойству, используйте оператор "<-", например "{0}.{1} <- expression". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались присваивать значение свойству, используйте оператор "<-", например "{1}.{2} <- expression". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались изменять значение, пометьте его как mutable и используйте оператор "<-", например "{0} <- expression". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались изменять значение, пометьте его как mutable и используйте оператор "<-", например "{1} <- expression". - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались изменять значение, используйте оператор "<-", например "{0} <- expression". + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Результат этого выражения равенства неявно удаляется. Рекомендуем использовать let, чтобы привязать результат к имени, например "let result = expression". Если вы собирались изменять значение, используйте оператор "<-", например "{1} <- expression". diff --git a/src/fsharp/xlf/FSStrings.tr.xlf b/src/fsharp/xlf/FSStrings.tr.xlf index a91af98c42..a676945d76 100644 --- a/src/fsharp/xlf/FSStrings.tr.xlf +++ b/src/fsharp/xlf/FSStrings.tr.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - Bu ifadenin sonucu örtük olarak yoksayılır. Bu değeri açıkça atmak için 'ignore' kullanmayı (örn. 'expr |> ignore') veya sonucu bir ada bağlamak için 'let' kullanmayı (örn. 'let result = expr') deneyin. + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + Bu ifadenin sonucu örtük olarak yoksayılır. Bu değeri açıkça atmak için 'ignore' kullanmayı (örn. 'expr |> ignore') veya sonucu bir ada bağlamak için 'let' kullanmayı (örn. 'let result = expr') deneyin. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. Bir özelliğin değerini ayarlamak istiyorsanız, '<-' işlecini kullanın; örneğin, '{0}.{1} <- deyim'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. Bir özelliğin değerini ayarlamak istiyorsanız, '<-' işlecini kullanın; örneğin, '{1}.{2} <- deyim'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. Bir değeri değiştirmek istiyorsanız, değeri 'mutable' olarak işaretleyin ve '<-' işlecini kullanın; örneğin, '{0} <- deyim'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün; örneğin, 'let sonuç = deyim'. Bir değeri değiştirmek istiyorsanız, değeri 'mutable' olarak işaretleyin ve '<-' işlecini kullanın; örneğin, '{1} <- deyim'. - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün, örneğin 'let sonuç = deyim'. Bir değeri değiştirmek istiyorsanız, '<-' işlecini kullanın; örneğin, '{0} <- deyim'. + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + Bu eşitlik ifadesinin sonucu örtük olarak atılmıştır. Sonucu bir ada bağlamak için 'let' kullanmayı düşünün, örneğin 'let sonuç = deyim'. Bir değeri değiştirmek istiyorsanız, '<-' işlecini kullanın; örneğin, '{1} <- deyim'. diff --git a/src/fsharp/xlf/FSStrings.zh-Hans.xlf b/src/fsharp/xlf/FSStrings.zh-Hans.xlf index 9e3ea8eb1c..daa876bb85 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hans.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hans.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - 此表达式的结果被隐式忽略。请考虑使用 "ignore" 以显式放弃该值,例如 "expr |> ignore" 或 "let" 以将结果绑定到一个名称,例如 "let result = expr"。 + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + 此表达式的结果被隐式忽略。请考虑使用 "ignore" 以显式放弃该值,例如 "expr |> ignore" 或 "let" 以将结果绑定到一个名称,例如 "let result = expr"。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果要为某属性设置值,请使用 "<-" 运算符,例如 "{0}.{1} <- expression"。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果要为某属性设置值,请使用 "<-" 运算符,例如 "{1}.{2} <- expression"。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果想要转变某个值,则将此值标记为 "mutable" 并使用 "<-" 运算符,例如 "{0} <- expression"。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果想要转变某个值,则将此值标记为 "mutable" 并使用 "<-" 运算符,例如 "{1} <- expression"。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果想要转变某个值,请使用 "<-" 运算符,例如 "{0} <- expression"。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + 此等式表达式的结果被隐式丢弃。请考虑使用 "let" 将结果绑定到一个名称,例如 "let result = expression"。如果想要转变某个值,请使用 "<-" 运算符,例如 "{1} <- expression"。 diff --git a/src/fsharp/xlf/FSStrings.zh-Hant.xlf b/src/fsharp/xlf/FSStrings.zh-Hant.xlf index 6cb55c0004..9428588ea0 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hant.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hant.xlf @@ -1283,28 +1283,28 @@ - The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. - 已隱含忽略運算式的結果。請考慮使用 'ignore' 以明確捨棄此值,例如 'expr |> ignore',或使用 'let' 將結果繫結至名稱,例如 'let result = expr'。 + The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + 已隱含忽略運算式的結果。請考慮使用 'ignore' 以明確捨棄此值,例如 'expr |> ignore',或使用 'let' 將結果繫結至名稱,例如 'let result = expr'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. + 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'. - 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要設定屬性值,則使用 '<-' 運算子,例如 '{0}.{1} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'. + 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要設定屬性值,則使用 '<-' 運算子,例如 '{1}.{2} <- expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'. - 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要變動值,請將值標示為 [可變動]5D; 並使用 '<-' 運算子,例如 '{0} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'. + 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要變動值,請將值標示為 [可變動]5D; 並使用 '<-' 運算子,例如 '{1} <- expression'。 - The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'. - 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要變動值,則使用 '<-' 運算子,例如 '{0} <- expression'。 + The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'. + 將隱含捨棄此等號比較運算式的結果。請考慮使用 'let' 將結果繫結至名稱,例如 'let result = expression'。若您要變動值,則使用 '<-' 運算子,例如 '{1} <- expression'。 diff --git a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs index e703b6ac2a..f450d0ec59 100644 --- a/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs +++ b/tests/fsharpqa/Source/Conformance/DeclarationElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs @@ -2,7 +2,7 @@ #light // Verify warning when 'do-bindings' do not return unit. -//The result of this expression is implicitly ignored +//The result of this expression has type 'int' and is implicitly ignored let square x = x * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in01.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in01.fs index 1d1442dc8e..7ff3e6a7bb 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in01.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in01.fs @@ -5,7 +5,7 @@ // Eventually, we will deprecated them - and the specs will be updated. // //The value or constructor 'a' is not defined -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ module A = let a = 3 in a + 1 |> ignore;; a > 4;; diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in02.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in02.fs index 323ff21db2..088eba8f3f 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in02.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in02.fs @@ -4,7 +4,7 @@ // I'm adding these cases to make sure we do not accidentally change the behavior from version to version // Eventually, we will deprecated them - and the specs will be updated. // -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ // module B = diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in03.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in03.fs index e0af19fb87..e1bc60f810 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in03.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in03.fs @@ -4,7 +4,7 @@ // I'm adding these cases to make sure we do not accidentally change the behavior from version to version // Eventually, we will deprecated them - and the specs will be updated. // -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ // module C = let a = 3 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in04.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in04.fs index 46ffb9b98b..1f4ddad634 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in04.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in04.fs @@ -4,7 +4,7 @@ // I'm adding these cases to make sure we do not accidentally change the behavior from version to version // Eventually, we will deprecated them - and the specs will be updated. // -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ // module D = diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs index 87d95d8fd3..eaefd989c1 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs @@ -5,7 +5,7 @@ // Eventually, we will deprecated them - and the specs will be updated. //The type 'int' does not match the type 'unit'$ //Type mismatch\. Expecting a. ''a -> 'b' .but given a. ''a -> unit' .The type 'int' does not match the type 'unit'$ -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ module E = let a = 3 in a + 1 |> ignore diff --git a/tests/fsharpqa/Source/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs b/tests/fsharpqa/Source/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs index bdb54bf3d7..e78a19b0fa 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/ControlFlowExpressions/TryFinally/W-TryFinallyNotUnit.fs @@ -2,7 +2,7 @@ #light // Verify warning if a finally block does not return 'unit' -//The result of this expression is implicitly ignored +//The result of this expression has type 'bool' and is implicitly ignored let x : int = try diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs b/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs index b930cbaba0..86e8689d06 100644 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs +++ b/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:5590 // This code used to compile, but fail peverification // Now, it just does not compile anymore telling the user to annotated it a bit. -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //Active pattern '\|A1\|A2\|A3\|' has a result type containing type variables that are not determined by the input\. The common cause is a when a result case is not mentioned, e\.g\. 'let \(\|A\|B\|\) \(x:int\) = A x'\. This can be fixed with a type constraint, e\.g\. 'let \(\|A\|B\|\) \(x:int\) : Choice = A x'$ let (|A1|A2|A3|) (inp:int) : Choice = printfn "hello" diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_Multiline02.fs b/tests/fsharpqa/Source/Diagnostics/General/W_Multiline02.fs index b68027a169..9905cd93d8 100644 --- a/tests/fsharpqa/Source/Diagnostics/General/W_Multiline02.fs +++ b/tests/fsharpqa/Source/Diagnostics/General/W_Multiline02.fs @@ -1,7 +1,7 @@ // #Regression #Diagnostics // Regression test for FSHARP1.0:3596 // Make sure that error spans correctly across multiple lines -//The result of this expression is implicitly ignored +//The result of this expression has type 'int' and is implicitly ignored #nowarn "988" let f g x = g x diff --git a/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs b/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs index f6f6443df6..42e04f7fa4 100644 --- a/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs +++ b/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs @@ -1,5 +1,5 @@ // #Regression #Diagnostics // Regression test for FSHARP1.0:2391, FSHARP1.0:1479 -//The result of this expression is implicitly ignored +//The result of this expression has type 'seq' and is implicitly ignored #light "off" <@@ 1 @@>.GetFreeVars() diff --git a/tests/fsharpqa/Source/Diagnostics/async/MissingIgnore.fs b/tests/fsharpqa/Source/Diagnostics/async/MissingIgnore.fs index 3fe0919320..85381cea43 100644 --- a/tests/fsharpqa/Source/Diagnostics/async/MissingIgnore.fs +++ b/tests/fsharpqa/Source/Diagnostics/async/MissingIgnore.fs @@ -1,5 +1,5 @@ // #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ async { 1; return 2 } |> ignore diff --git a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop01.fs b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop01.fs index 4dd57691e8..22ebb43bd2 100644 --- a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop01.fs +++ b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop01.fs @@ -1,5 +1,5 @@ // #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ let rec loop() = async { let x = 1 in loop() } diff --git a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop02.fs b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop02.fs index a9bb89c9da..a7c5b2b146 100644 --- a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop02.fs +++ b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop02.fs @@ -1,5 +1,5 @@ // #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ let rec loop() = async { loop() } diff --git a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop03.fs b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop03.fs index dfba108aac..277028e9bb 100644 --- a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop03.fs +++ b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop03.fs @@ -1,6 +1,6 @@ // #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //This expression was expected to have type. 'Async<'a>' .but here has type. 'unit' let rec loop2() = async.Delay(fun () -> loop2(); ()); diff --git a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop04.fs b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop04.fs index b86efb6713..761020c2ec 100644 --- a/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop04.fs +++ b/tests/fsharpqa/Source/Diagnostics/async/MissingReturnBangForLoop04.fs @@ -1,7 +1,7 @@ // #Regression #Diagnostics #Async // Regression tests for FSHARP1.0:4394 // common mistake: forgetting the return! For a loop -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'Async<'a>' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ //This expression was expected to have type. 'Async<'a>' .but here has type. 'unit' // Note: interestingly, this looks much better if a method call is not used let delay x = async.Delay x diff --git a/tests/fsharpqa/Source/Misc/Parsing02.fs b/tests/fsharpqa/Source/Misc/Parsing02.fs index 9a17369e87..55b5997b46 100644 --- a/tests/fsharpqa/Source/Misc/Parsing02.fs +++ b/tests/fsharpqa/Source/Misc/Parsing02.fs @@ -1,8 +1,8 @@ // #Regression #Misc // Verify warnings associated with top level expressions getting discarded -//The result of this expression is implicitly ignored -//The result of this expression is implicitly ignored +//The result of this expression has type +//The result of this expression has type // Note the comma between printf "%A", this results in a tuple expr which probably wasn't intended. let arr = [|"Foo"; "Bar"|] diff --git a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs b/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs index f36f891994..4492e6338c 100644 --- a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs +++ b/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs @@ -1,5 +1,5 @@ // #Warnings -//The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. +//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. type MyClass(property1 : int) = member val Property2 = "" with get diff --git a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs b/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs index e43c60b38d..9480f35b6b 100644 --- a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs +++ b/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs @@ -1,5 +1,5 @@ // #Warnings -//The result of this expression is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ +//The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ 1 + 2 printfn "%d" 3 diff --git a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs b/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs index d0acf39cbe..ad7f9deacd 100644 --- a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs +++ b/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs @@ -1,5 +1,5 @@ // #Warnings -//The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. +//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. let x = 10 let y = 20 diff --git a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs b/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs index ac96be2f92..6f2ef4d9c4 100644 --- a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs +++ b/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs @@ -1,5 +1,5 @@ // #Warnings -// +// let mutable x = 0 while x < 1 do From 09fc352f5d48a7d441dd0adeed1bb74f8a912883 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 24 Jan 2018 10:35:04 +0300 Subject: [PATCH 08/15] [WIP] Fix inlline rename at end of file (#3766) * do not filter symbol uses by range length in getSymbolUsesInSolution because it causes loosing symbol occurrences in Inline Rename * make impl closer to the XAML one * remove obsolete import --- .../InlineRename/InlineRenameService.fs | 87 ++++++++++--------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs index 81d87ed4a5..cde09f1dbe 100644 --- a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs +++ b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs @@ -4,7 +4,6 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System open System.Composition -open System.Collections.Generic open System.Linq open System.Threading open System.Threading.Tasks @@ -29,44 +28,43 @@ type internal FailureInlineRenameInfo private () = member __.DisplayName = "" member __.FullDisplayName = "" member __.Glyph = Glyph.MethodPublic - member __.GetFinalSymbolName _replacementText = "" - member __.GetReferenceEditSpan(_location, _cancellationToken) = Unchecked.defaultof<_> - member __.GetConflictEditSpan(_location, _replacementText, _cancellationToken) = Nullable() - member __.FindRenameLocationsAsync(_optionSet, _cancellationToken) = Task.FromResult null - member __.TryOnBeforeGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = false - member __.TryOnAfterGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = false + member __.GetFinalSymbolName _ = "" + member __.GetReferenceEditSpan(_, _) = Unchecked.defaultof<_> + member __.GetConflictEditSpan(_, _, _) = Nullable() + member __.FindRenameLocationsAsync(_, _) = Task.FromResult null + member __.TryOnBeforeGlobalSymbolRenamed(_, _, _) = false + member __.TryOnAfterGlobalSymbolRenamed(_, _, _) = false static member Instance = FailureInlineRenameInfo() :> IInlineRenameInfo -type internal DocumentLocations = - { Document: Document - Locations: InlineRenameLocation [] } - -type internal InlineRenameLocationSet(locationsByDocument: DocumentLocations [], originalSolution: Solution, symbolKind: LexerSymbolKind, symbol: FSharpSymbol) = +type internal InlineRenameLocationSet(locations: InlineRenameLocation [], originalSolution: Solution, symbolKind: LexerSymbolKind, symbol: FSharpSymbol) = interface IInlineRenameLocationSet with - member __.Locations : IList = - upcast [| for doc in locationsByDocument do yield! doc.Locations |].ToList() + member __.Locations = upcast locations.ToList() - member this.GetReplacementsAsync(replacementText, _optionSet, cancellationToken) : Task = - let rec applyChanges i (solution: Solution) = + member __.GetReplacementsAsync(replacementText, _optionSet, cancellationToken) : Task = + let rec applyChanges (solution: Solution) (locationsByDocument: (Document * InlineRenameLocation list) list) = async { - if i = locationsByDocument.Length then - return solution - else - let doc = locationsByDocument.[i] - let! oldSourceText = doc.Document.GetTextAsync(cancellationToken) |> Async.AwaitTask - let changes = doc.Locations |> Seq.map (fun loc -> TextChange(loc.TextSpan, replacementText)) - let newSource = oldSourceText.WithChanges(changes) - return! applyChanges (i + 1) (solution.WithDocumentText(doc.Document.Id, newSource)) + match locationsByDocument with + | [] -> return solution + | (document, locations) :: rest -> + let! oldSource = document.GetTextAsync(cancellationToken) |> Async.AwaitTask + let newSource = oldSource.WithChanges(locations |> List.map (fun l -> TextChange(l.TextSpan, replacementText))) + return! applyChanges (solution.WithDocumentText(document.Id, newSource)) rest } async { - let! newSolution = applyChanges 0 originalSolution + let! newSolution = applyChanges originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document)) + // > debug + let newDoc = newSolution.GetDocument(locations.[0].Document.Id) + let! newSource = newDoc.GetTextAsync(cancellationToken) |> Async.AwaitTask + let newText = newSource.ToString() + let _ = newText + // < debug return { new IInlineRenameReplacementInfo with member __.NewSolution = newSolution member __.ReplacementTextValid = Tokenizer.isValidNameForSymbol(symbolKind, symbol, replacementText) - member __.DocumentIds = locationsByDocument |> Seq.map (fun doc -> doc.Document.Id) - member __.GetReplacements(documentId) = Seq.empty } + member __.DocumentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct + member __.GetReplacements _ = Seq.empty } } |> RoslynHelpers.StartAsyncAsTask(cancellationToken) @@ -98,7 +96,7 @@ type internal InlineRenameInfo member __.LocalizedErrorMessage = null member __.TriggerSpan = triggerSpan member __.HasOverloads = false - member __.ForceRenameOverloads = true + member __.ForceRenameOverloads = false member __.DisplayName = symbolUse.Symbol.DisplayName member __.FullDisplayName = try symbolUse.Symbol.FullName with _ -> symbolUse.Symbol.DisplayName member __.Glyph = Glyph.MethodPublic @@ -108,30 +106,34 @@ type internal InlineRenameInfo let text = getDocumentText location.Document cancellationToken Tokenizer.fixupSpan(text, location.TextSpan) - member __.GetConflictEditSpan(location, _replacementText, _cancellationToken) = Nullable(location.TextSpan) + member __.GetConflictEditSpan(location, replacementText, cancellationToken) = + let text = getDocumentText location.Document cancellationToken + let spanText = text.ToString(location.TextSpan) + let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal) + if position < 0 then Nullable() + else Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length)) member __.FindRenameLocationsAsync(_optionSet, cancellationToken) = async { let! symbolUsesByDocumentId = symbolUses - let! locationsByDocument = + let! locations = symbolUsesByDocumentId |> Seq.map (fun (KeyValue(documentId, symbolUses)) -> async { let document = document.Project.Solution.GetDocument(documentId) - let! cancellationToken = Async.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask - let locations = - symbolUses - |> Array.choose (fun symbolUse -> - RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.RangeAlternate) - |> Option.map (fun span -> - let textSpan = Tokenizer.fixupSpan(sourceText, span) - InlineRenameLocation(document, textSpan))) - - return { Document = document; Locations = locations } + return + [| for symbolUse in symbolUses do + match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.RangeAlternate) with + | Some span -> + let textSpan = Tokenizer.fixupSpan(sourceText, span) + yield InlineRenameLocation(document, textSpan) + | None -> () |] }) |> Async.Parallel - return InlineRenameLocationSet(locationsByDocument, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> IInlineRenameLocationSet + |> Async.map Array.concat + + return InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> IInlineRenameLocationSet } |> RoslynHelpers.StartAsyncAsTask(cancellationToken) member __.TryOnBeforeGlobalSymbolRenamed(_workspace, _changedDocumentIDs, _replacementText) = true @@ -142,8 +144,7 @@ type internal InlineRenameService [] ( projectInfoManager: FSharpProjectOptionsManager, - checkerProvider: FSharpCheckerProvider, - [] _refactorNotifyServices: seq + checkerProvider: FSharpCheckerProvider ) = static let userOpName = "InlineRename" From d70a450a2d43b848a08d78c9b71da6edd11c4f4b Mon Sep 17 00:00:00 2001 From: Jason Imison Date: Wed, 24 Jan 2018 09:03:39 +0000 Subject: [PATCH 09/15] Get declaration list symbols (#4204) * Update GetDeclarationListSymbols to add getAllEntities * Don't group types with the same display name as function overloads. Now that we can include all entities for top level completions, the grouping function can incorrectly group types with the same display name as function overloads. Use the compiled name instead as this includes the namespace. * Get logical name from ExnCase * Make getAllEntities optional Also renamed getAllSymbols to getAllEntities everywhere for consistency --- src/fsharp/service/service.fs | 32 ++++++++++++++++++++++---------- src/fsharp/service/service.fsi | 12 ++++++------ tests/service/EditorTests.fs | 6 +++--- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 9867372c90..6ee8a0098d 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -930,11 +930,11 @@ type TypeCheckInfo scope.IsRelativeNameResolvable(cursorPos, plid, symbol.Item) /// Get the auto-complete items at a location - member __.GetDeclarations (ctok, parseResultsOpt, line, lineStr, partialName, getAllSymbols, hasTextChangedSinceLastTypecheck) = + member __.GetDeclarations (ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck) = let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName ErrorScope.Protect Range.range0 (fun () -> - match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllSymbols, hasTextChangedSinceLastTypecheck) with + match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with | None -> FSharpDeclarationListInfo.Empty | Some (items, denv, ctx, m) -> let items = if isInterfaceFile then items |> List.filter (fun x -> IsValidSignatureFileItem x.Item) else items @@ -950,11 +950,11 @@ type TypeCheckInfo FSharpDeclarationListInfo.Error msg) /// Get the symbols for auto-complete items at a location - member __.GetDeclarationListSymbols (ctok, parseResultsOpt, line, lineStr, partialName, hasTextChangedSinceLastTypecheck) = + member __.GetDeclarationListSymbols (ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck) = let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName ErrorScope.Protect Range.range0 (fun () -> - match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, (fun () -> []), hasTextChangedSinceLastTypecheck) with + match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with | None -> List.Empty | Some (items, denv, _, m) -> let items = if isInterfaceFile then items |> List.filter (fun x -> IsValidSignatureFileItem x.Item) else items @@ -966,7 +966,7 @@ type TypeCheckInfo // - show types with fewer generic parameters first // - show types before over other related items - they usually have very useful XmlDocs let items = - items |> List.sortBy (fun d -> + items |> List.sortBy (fun d -> let n = match d.Item with | Item.Types (_,(TType_app(tcref,_) :: _)) -> 1 + tcref.TyparsNoRange.Length @@ -981,8 +981,18 @@ type TypeCheckInfo // Remove all duplicates. We've put the types first, so this removes the DelegateCtor and DefaultStructCtor's. let items = items |> RemoveDuplicateCompletionItems g - // Group by display name - let items = items |> List.groupBy (fun d -> d.Item.DisplayName) + // Group by compiled name for types, display name for functions + // (We don't want types with the same display name to be grouped as overloads) + let items = + items |> List.groupBy (fun d -> + match d.Item with + | Item.Types (_,(TType_app(tcref,_) :: _)) + | Item.ExnCase tcref -> tcref.LogicalName + | Item.UnqualifiedType(tcref :: _) + | Item.FakeInterfaceCtor (TType_app(tcref,_)) + | Item.DelegateCtor (TType_app(tcref,_)) -> tcref.CompiledName + | Item.CtorGroup (_, (cinfo :: _)) -> (tcrefOfAppTy g cinfo.EnclosingType).CompiledName + | _ -> d.Item.DisplayName) // Filter out operators (and list) let items = @@ -1928,16 +1938,18 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp member info.HasFullTypeCheckInfo = details.IsSome /// Intellisense autocompletions - member info.GetDeclarationListInfo(parseResultsOpt, line, lineStr, partialName, getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) = + member info.GetDeclarationListInfo(parseResultsOpt, line, lineStr, partialName, ?getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" + let getAllEntities = defaultArg getAllEntities (fun() -> []) let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false) reactorOp userOpName "GetDeclarations" FSharpDeclarationListInfo.Empty (fun ctok scope -> scope.GetDeclarations(ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck)) - member info.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) = + member info.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, ?getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false) - reactorOp userOpName "GetDeclarationListSymbols" List.empty (fun ctok scope -> scope.GetDeclarationListSymbols(ctok, parseResultsOpt, line, lineStr, partialName, hasTextChangedSinceLastTypecheck)) + let getAllEntities = defaultArg getAllEntities (fun() -> []) + reactorOp userOpName "GetDeclarationListSymbols" List.empty (fun ctok scope -> scope.GetDeclarationListSymbols(ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck)) /// Resolve the names at the given location to give a data tip member info.GetStructuredToolTipText(line, colAtEndOfNames, lineStr, names, tokenTag, ?userOpName: string) = diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index 2602d82e4f..2bc107b892 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -119,8 +119,8 @@ type public FSharpCheckFileResults = /// The text of the line where the completion is happening. This is only used to make a couple /// of adhoc corrections to completion accuracy (e.g. checking for "..") /// - /// - /// Function that returns all symbols from current and referenced assemblies. + /// + /// Function that returns all entities from current and referenced assemblies. /// /// /// If text has been used from a captured name resolution from the typecheck, then @@ -128,7 +128,7 @@ type public FSharpCheckFileResults = /// and assume that we're going to repeat the operation later on. /// /// An optional string used for tracing compiler operations associated with this request. - member GetDeclarationListInfo : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * getAllSymbols: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async + member GetDeclarationListInfo : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?getAllEntities: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async /// Get the items for a declaration list in FSharpSymbol format /// @@ -145,8 +145,8 @@ type public FSharpCheckFileResults = /// The text of the line where the completion is happening. This is only used to make a couple /// of adhoc corrections to completion accuracy (e.g. checking for "..") /// - /// - /// Function that returns all symbols from current and referenced assemblies. + /// + /// Function that returns all entities from current and referenced assemblies. /// /// /// If text has been used from a captured name resolution from the typecheck, then @@ -154,7 +154,7 @@ type public FSharpCheckFileResults = /// and assume that we're going to repeat the operation later on. /// /// An optional string used for tracing compiler operations associated with this request. - member GetDeclarationListSymbols : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async + member GetDeclarationListSymbols : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?getAllEntities: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async /// Compute a formatted tooltip for the given location diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index b81c0d18a5..39f89c3874 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -348,7 +348,7 @@ type Test() = let file = "/home/user/Test.fsx" let parseResult, typeCheckResults = parseAndCheckScript(file, input) - let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(20), fun _ -> false)|> Async.RunSynchronously + let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(20), (fun () -> []), fun _ -> false)|> Async.RunSynchronously //decls |> List.map (fun d -> d.Head.Symbol.DisplayName) |> printfn "---> decls = %A" decls |> Seq.exists (fun d -> d.Head.Symbol.DisplayName = "abc") |> shouldEqual true @@ -365,7 +365,7 @@ type Test() = let file = "/home/user/Test.fsx" let parseResult, typeCheckResults = parseAndCheckScript(file, input) - let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(21), fun _ -> false)|> Async.RunSynchronously + let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(21), (fun () -> []), fun _ -> false)|> Async.RunSynchronously //decls |> List.map (fun d -> d.Head.Symbol.DisplayName) |> printfn "---> decls = %A" decls |> Seq.exists (fun d -> d.Head.Symbol.DisplayName = "abc") |> shouldEqual true @@ -382,7 +382,7 @@ type Test() = let file = "/home/user/Test.fsx" let parseResult, typeCheckResults = parseAndCheckScript(file, input) - let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(14), fun _ -> false)|> Async.RunSynchronously + let decls = typeCheckResults.GetDeclarationListSymbols(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(14), (fun () -> []), fun _ -> false)|> Async.RunSynchronously //decls |> List.map (fun d -> d.Head.Symbol.DisplayName) |> printfn "---> decls = %A" decls |> Seq.exists (fun d -> d.Head.Symbol.DisplayName = "abc") |> shouldEqual true From e2af0fa04aeeabfa61aa7261c260f44bcde0adfa Mon Sep 17 00:00:00 2001 From: Jason Imison Date: Wed, 24 Jan 2018 17:12:05 +0000 Subject: [PATCH 10/15] Fix CI. fixes #4256 (#4257) --- src/fsharp/service/service.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 6ee8a0098d..a2dca027e4 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -991,7 +991,8 @@ type TypeCheckInfo | Item.UnqualifiedType(tcref :: _) | Item.FakeInterfaceCtor (TType_app(tcref,_)) | Item.DelegateCtor (TType_app(tcref,_)) -> tcref.CompiledName - | Item.CtorGroup (_, (cinfo :: _)) -> (tcrefOfAppTy g cinfo.EnclosingType).CompiledName + | Item.CtorGroup (_, (cinfo :: _)) -> + (tcrefOfAppTy g cinfo.ApparentEnclosingType).CompiledName | _ -> d.Item.DisplayName) // Filter out operators (and list) From 5728b68d9fea67aaf45f810b2f602419c1094b92 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 24 Jan 2018 18:17:51 -0800 Subject: [PATCH 11/15] Improve compiler designtime probing (#4250) --- src/fsharp/ExtensionTyping.fs | 13 ++--- .../ProductVersion.fs | 16 +++--- tests/fsharp/TypeProviderTests.fs | 52 +++++-------------- .../provider.fs | 0 .../providerDesigner.fsx | 0 .../test.fsx | 0 .../splitAssemblyTypeproviders/provider.fs | 17 ++++++ .../providerDesigner.fsx | 51 ++++++++++++++++++ .../splitAssemblyTypeproviders/test.fsx | 32 ++++++++++++ 9 files changed, 125 insertions(+), 56 deletions(-) rename tests/fsharp/typeProviders/{splitAssembly => splitAssemblyTools}/provider.fs (100%) rename tests/fsharp/typeProviders/{splitAssembly => splitAssemblyTools}/providerDesigner.fsx (100%) rename tests/fsharp/typeProviders/{splitAssembly => splitAssemblyTools}/test.fsx (100%) create mode 100644 tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs create mode 100644 tests/fsharp/typeProviders/splitAssemblyTypeproviders/providerDesigner.fsx create mode 100644 tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index d348e13c58..b1d46b8eba 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -38,6 +38,7 @@ module internal ExtensionTyping = // Specify the tooling-compatible fragments of a path such as: // typeproviders/fsharp41/net461/MyProvider.DesignTime.dll + // tools/fsharp41/net461/MyProvider.DesignTime.dll // See https://github.com/Microsoft/visualfsharp/issues/3736 // Represents the FF#-compiler <-> type provider protocol. @@ -55,16 +56,12 @@ module internal ExtensionTyping = System.Diagnostics.Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0") [ "netstandard2.0"] - // When significant new processor types appear add a new moniker here. Note that use of this qualifier will be very rare - // and we don't expect different design-time assemblies will be needed for different architectures very often. Some - // exceptions may be design-time components for type providers for systems such as Python or R. - let toolingCompatibleArch() = if sizeof = 8 then "x64" else "x86" + let toolingCompatiblePaths() = [ for protocol in toolingCompatibleTypeProviderProtocolMonikers() do - for netRuntime in toolingCompatibleVersions() do - let dir = Path.Combine("typeproviders", protocol, netRuntime) - yield Path.Combine(dir, toolingCompatibleArch()) - yield dir + for netRuntime in toolingCompatibleVersions() do + yield Path.Combine("typeproviders", protocol, netRuntime) + yield Path.Combine("tools", protocol, netRuntime) ] /// Load a the design-time part of a type-provider into the host process, and look for types diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index 3b3eab8a3c..db57334b73 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -111,18 +111,16 @@ module TypeProviderDesignTimeComponentLoading = [] let ``check tooling paths for type provider design time component loading`` () = - let arch = if sizeof = 8 then "x64" else "x86" - let expected = - [ @"typeproviders\fsharp41\net461\" + arch - @"typeproviders\fsharp41\net461" - @"typeproviders\fsharp41\net452\" + arch + let expected = + [ @"typeproviders\fsharp41\net461" + @"tools\fsharp41\net461" @"typeproviders\fsharp41\net452" - @"typeproviders\fsharp41\net451\" + arch + @"tools\fsharp41\net452" @"typeproviders\fsharp41\net451" - @"typeproviders\fsharp41\net45\" + arch + @"tools\fsharp41\net451" @"typeproviders\fsharp41\net45" - @"typeproviders\fsharp41\netstandard2.0\" + arch + @"tools\fsharp41\net45" @"typeproviders\fsharp41\netstandard2.0" - ] + @"tools\fsharp41\netstandard2.0" ] let actual = Microsoft.FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths() Assert.areEqual expected actual diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs index edfd0ec742..00633234ea 100644 --- a/tests/fsharp/TypeProviderTests.fs +++ b/tests/fsharp/TypeProviderTests.fs @@ -248,15 +248,16 @@ let ``negative type provider tests`` (name:string) = SingleTest.singleNegTest cfg name -[] -let splitAssembly () = +let splitAssembly subdir project = - let cfg = testConfig "typeProviders/splitAssembly" + let cfg = testConfig project let clean() = rm cfg "providerDesigner.dll" rmdir cfg "typeproviders" + rmdir cfg "tools" rmdir cfg (".." ++ "typeproviders") + rmdir cfg (".." ++ "tools") clean() @@ -276,20 +277,11 @@ let splitAssembly () = // check a few load locations let someLoadPaths = - [ "typeproviders" ++ "fsharp41" ++ "net461" ++ "x86" - "typeproviders" ++ "fsharp41" ++ "net461" - "typeproviders" ++ "fsharp41" ++ "net45" + [ subdir ++ "fsharp41" ++ "net461" + subdir ++ "fsharp41" ++ "net45" // include up one directory - ".." ++ "typeproviders" ++ "fsharp41" ++ "net45" - "typeproviders" ++ "fsharp41" ++ "netstandard2.0" ] - - let someLoadPaths64 = - [ "typeproviders" ++ "fsharp41" ++ "net461" ++ "x64" - "typeproviders" ++ "fsharp41" ++ "net461" ] - - let someNegativeLoadPaths64 = - [ "typeproviders" ++ "fsharp41" ++ "net461" ++ "x86" ] - + ".." ++ subdir ++ "fsharp41" ++ "net45" + subdir ++ "fsharp41" ++ "netstandard2.0" ] for dir in someLoadPaths do @@ -311,31 +303,13 @@ let splitAssembly () = SingleTest.singleTestBuildAndRunAux cfg FSI_BASIC - for dir in someLoadPaths64 do - - clean() - - // put providerDesigner.dll into a different place - mkdir cfg dir - fsc cfg "--out:%s/providerDesigner.dll -a" dir ["providerDesigner.fsx"] - - SingleTest.singleTestBuildAndRunAux cfg FSIANYCPU_BASIC - - for dir in someNegativeLoadPaths64 do - - clean() - - // put providerDesigner.dll into a different place - mkdir cfg dir - fsc cfg "--out:%s/providerDesigner.dll -a" dir ["providerDesigner.fsx"] + clean() - // We expect a failure here - an error correctly gets printed on the console - try - SingleTest.singleTestBuildAndRunAux cfg FSIANYCPU_BASIC |> ignore - failwith "expected an AssertionException" - with :? NUnit.Framework.AssertionException -> () +[] +let splitAssemblyTools () = splitAssembly "tools" "typeProviders/splitAssemblyTools" - clean() +[] +let splitAssemblyTypeProviders () = splitAssembly "typeproviders" "typeProviders/splitAssemblyTypeproviders" [] let wedgeAssembly () = diff --git a/tests/fsharp/typeProviders/splitAssembly/provider.fs b/tests/fsharp/typeProviders/splitAssemblyTools/provider.fs similarity index 100% rename from tests/fsharp/typeProviders/splitAssembly/provider.fs rename to tests/fsharp/typeProviders/splitAssemblyTools/provider.fs diff --git a/tests/fsharp/typeProviders/splitAssembly/providerDesigner.fsx b/tests/fsharp/typeProviders/splitAssemblyTools/providerDesigner.fsx similarity index 100% rename from tests/fsharp/typeProviders/splitAssembly/providerDesigner.fsx rename to tests/fsharp/typeProviders/splitAssemblyTools/providerDesigner.fsx diff --git a/tests/fsharp/typeProviders/splitAssembly/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx similarity index 100% rename from tests/fsharp/typeProviders/splitAssembly/test.fsx rename to tests/fsharp/typeProviders/splitAssemblyTools/test.fsx diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs new file mode 100644 index 0000000000..732486441a --- /dev/null +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.fs @@ -0,0 +1,17 @@ +namespace Microsoft.FSharp.Core.CompilerServices + +type TypeProviderAssemblyAttribute(assemblyName) = + inherit System.Attribute() + + new() = TypeProviderAssemblyAttribute(null) + member this.AssemblyName + with get () = assemblyName + +[] +do() + + +namespace My + type Runtime = + static member Id x = x + diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/providerDesigner.fsx b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/providerDesigner.fsx new file mode 100644 index 0000000000..3f2183fd89 --- /dev/null +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/providerDesigner.fsx @@ -0,0 +1,51 @@ +namespace Provider +#load @"..\helloWorld\TypeMagic.fs" +open Microsoft.FSharp.Core.CompilerServices +open System.Collections.Generic +open System.IO +open System +open System.Reflection +open System.Linq.Expressions +open FSharp.TypeMagic + +[] +type public Provider(config : TypeProviderConfig) = + let runtimeAssembly = Assembly.ReflectionOnlyLoadFrom(config.RuntimeAssembly) + let modul = runtimeAssembly.GetModules().[0] + + let ``My.Runtime`` = runtimeAssembly.GetType("My.Runtime") + let rootNamespace = "FSharp.SplitAssembly" + let invalidation = new Event() + + let theType = + let rec members = + lazy + [| let p = TypeBuilder.CreateSyntheticProperty(theType,"Foo",typeof,isStatic=true) + yield! TypeBuilder.JoinPropertiesIntoMemberInfos [p] + |] + and theType = + TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace),"TheType", members = members) + theType + + interface IProvidedNamespace with + member this.NamespaceName = rootNamespace + member this.GetNestedNamespaces() = [||] + member this.ResolveTypeName typeName = + match typeName with + | "TheType" -> theType + | _ -> null + member this.GetTypes() = [| theType |] + + interface IDisposable with + member __.Dispose() = () + interface ITypeProvider with + member this.ApplyStaticArguments (st,_,_) = st + member this.GetInvokerExpression(mb,p) = + let mi = ``My.Runtime``.GetMethod("Id").MakeGenericMethod([|typeof|]) + Quotations.Expr.Call(mi, [ Quotations.Expr.Value(42) ]) + member this.GetNamespaces() = [| this |] + member this.GetStaticParameters st = [||] + [] + member this.Invalidate = invalidation.Publish + member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!" + diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx new file mode 100644 index 0000000000..e25871ab5f --- /dev/null +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx @@ -0,0 +1,32 @@ +#r "provider.dll" + +let mutable failures = [] +let reportFailure s = + stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s] + +let check s e r = + if r = e then stdout.WriteLine (s+": YES") + else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); reportFailure s) + +let test s b = + if b then ( (* stdout.WriteLine ("passed: " + s) *) ) + else (stderr.WriteLine ("failure: " + s); + reportFailure s) +(*========================================================================*) + +check "fgdjkwefg" + FSharp.SplitAssembly.TheType.Foo + 42 + +(*--------------------------------------------------------------------------- +!* wrap up + *--------------------------------------------------------------------------- *) + +let _ = + if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) + +do (stdout.WriteLine "Test Passed"; + System.IO.File.WriteAllText("test.ok","ok"); + exit 0) + + From e2168fa959d7b42470b154acdcd999aaa65937ec Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Sun, 28 Jan 2018 20:59:01 -0800 Subject: [PATCH 12/15] Enable preferreduilang for fsi (#4253) * Add support for --preferreduilang in fsi.exe * Prefereduiculture for fsi * Remove dead code --- src/FSharpSource.Profiles.targets | 2 -- src/fsharp/CompileOps.fs | 6 ---- src/fsharp/CompileOps.fsi | 6 ---- src/fsharp/CompileOptions.fs | 8 ----- src/fsharp/fsc.fs | 6 ---- src/fsharp/fsi/fsi.fs | 30 ++++--------------- .../Project/ProjectNode.cs | 7 ----- .../Project/ProjectSystem.Base.csproj | 1 - 8 files changed, 6 insertions(+), 60 deletions(-) diff --git a/src/FSharpSource.Profiles.targets b/src/FSharpSource.Profiles.targets index d56c1d703f..274cbf5108 100644 --- a/src/FSharpSource.Profiles.targets +++ b/src/FSharpSource.Profiles.targets @@ -3,7 +3,6 @@ - $(DefineConstants);PREFERRED_UI_LANG $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);BE_SECURITY_TRANSPARENT $(DefineConstants);FX_LCIDFROMCODEPAGE @@ -15,7 +14,6 @@ $(DefineConstants);FX_PORTABLE_OR_NETSTANDARD $(DefineConstants);NETSTANDARD1_6 - $(DefineConstants);PREFERRED_UI_LANG $(DefineConstants);FX_NO_APP_DOMAINS $(DefineConstants);FX_NO_ARRAY_LONG_LENGTH $(DefineConstants);FX_NO_BEGINEND_READWRITE diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 736c097a54..8558c29b3e 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2287,9 +2287,7 @@ type TcConfigBuilder = mutable optSettings : Optimizer.OptimizationSettings mutable emitTailcalls : bool mutable deterministic : bool -#if PREFERRED_UI_LANG mutable preferredUiLang: string option -#endif mutable lcid : int option mutable productNameForBannerText : string /// show the MS (c) notice, e.g. with help or fsi? @@ -2448,9 +2446,7 @@ type TcConfigBuilder = optSettings = Optimizer.OptimizationSettings.Defaults emitTailcalls = true deterministic = false -#if PREFERRED_UI_LANG preferredUiLang = None -#endif lcid = None // See bug 6071 for product banner spec productNameForBannerText = FSComp.SR.buildProductName(FSharpEnvironment.FSharpBannerVersion) @@ -2914,9 +2910,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) = member x.optSettings = data.optSettings member x.emitTailcalls = data.emitTailcalls member x.deterministic = data.deterministic -#if PREFERRED_UI_LANG member x.preferredUiLang = data.preferredUiLang -#endif member x.lcid = data.lcid member x.optsOn = data.optsOn member x.productNameForBannerText = data.productNameForBannerText diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index ad6a7f1648..1d7d2b1f77 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -331,9 +331,7 @@ type TcConfigBuilder = mutable optSettings : Optimizer.OptimizationSettings mutable emitTailcalls: bool mutable deterministic: bool -#if PREFERRED_UI_LANG mutable preferredUiLang: string option -#endif mutable lcid : int option mutable productNameForBannerText: string mutable showBanner : bool @@ -481,11 +479,7 @@ type TcConfig = member optSettings : Optimizer.OptimizationSettings member emitTailcalls: bool member deterministic: bool -#if PREFERRED_UI_LANG member preferredUiLang: string option -#else - member lcid : int option -#endif member optsOn : bool member productNameForBannerText: string member showBanner : bool diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 1c78fd9aa3..7f9c71b633 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -739,10 +739,8 @@ let codePageFlag (tcConfigB : TcConfigBuilder) = tcConfigB.inputCodePage <- Some(n)), None, Some (FSComp.SR.optsCodepage())) -#if PREFERRED_UI_LANG let preferredUiLang (tcConfigB: TcConfigBuilder) = CompilerOption("preferreduilang", tagString, OptionString (fun s -> tcConfigB.preferredUiLang <- Some(s)), None, Some(FSComp.SR.optsPreferredUiLang())) -#endif let utf8OutputFlag (tcConfigB: TcConfigBuilder) = CompilerOption("utf8output", tagNone, OptionUnit (fun () -> tcConfigB.utf8output <- true), None, @@ -771,9 +769,7 @@ let advancedFlagsBoth tcConfigB = [ yield codePageFlag tcConfigB yield utf8OutputFlag tcConfigB -#if PREFERRED_UI_LANG yield preferredUiLang tcConfigB -#endif yield fullPathsFlag tcConfigB yield libFlag tcConfigB yield CompilerOption("simpleresolution", @@ -849,11 +845,7 @@ let testFlag tcConfigB = let vsSpecificFlags (tcConfigB: TcConfigBuilder) = [ CompilerOption("vserrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.VSErrors), None, None) CompilerOption("validate-type-providers", tagNone, OptionUnit (id), None, None) // preserved for compatibility's sake, no longer has any effect -#if PREFERRED_UI_LANG CompilerOption("LCID", tagInt, OptionInt (fun _n -> ()), None, None) -#else - CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None) -#endif CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None) CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some with e -> None), None, None) CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index f6d7b4c6b8..b355ac50c0 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1635,7 +1635,6 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie let directoryBuildingFrom = Directory.GetCurrentDirectory() let setProcessThreadLocals tcConfigB = tcConfigB.openBinariesInMemory <- openBinariesInMemory -#if PREFERRED_UI_LANG match tcConfigB.preferredUiLang with #if FX_RESHAPED_GLOBALIZATION | Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s) @@ -1643,11 +1642,6 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie | Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s) #endif | None -> () -#else - match tcConfigB.lcid with - | Some n -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n) - | None -> () -#endif if tcConfigB.utf8output then Console.OutputEncoding <- Encoding.UTF8 diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 1fb69f2fc4..b79e692450 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -2419,19 +2419,6 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i // We later switch to doing interaction-by-interaction processing on the "event loop" thread. let ctokStartup = AssumeCompilationThreadWithoutEvidence () -#if FX_LCIDFROMCODEPAGE - - // See Bug 735819 - let lcidFromCodePage = - if (Console.OutputEncoding.CodePage <> 65001) && - (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) && - (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) then - Thread.CurrentThread.CurrentUICulture <- new CultureInfo("en-US") - Some 1033 - else - None -#endif - let timeReporter = FsiTimeReporter(outWriter) #if !FX_RESHAPED_CONSOLE @@ -2494,19 +2481,14 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i let fsiOptions = FsiCommandLineOptions(fsi, argv, tcConfigB, fsiConsoleOutput) let fsiConsolePrompt = FsiConsolePrompt(fsiOptions, fsiConsoleOutput) - // Check if we have a codepage from the console -#if FX_LCIDFROMCODEPAGE do - match fsiOptions.FsiLCID with - | Some _ -> () - | None -> tcConfigB.lcid <- lcidFromCodePage - - // Set the ui culture - do - match fsiOptions.FsiLCID with - | Some(n) -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n) - | None -> () + match tcConfigB.preferredUiLang with +#if FX_RESHAPED_GLOBALIZATION + | Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s) +#else + | Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s) #endif + | None -> () #if !FX_NO_SERVERCODEPAGES do diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectNode.cs b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectNode.cs index 56f9048f45..252bd09901 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectNode.cs +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectNode.cs @@ -3277,16 +3277,9 @@ internal virtual BuildSubmission DoMSBuildSubmission(BuildKind buildKind, string projectInstance.SetProperty("UTFOutput", "true"); -#if FX_PREFERRED_UI_LANG // The CoreCLR build of FSC will use the CultureName since lcid doesn't apply very well // so that the errors reported by fsc.exe are in the right locale projectInstance.SetProperty("PREFERREDUILANG", System.Threading.Thread.CurrentThread.CurrentUICulture.Name); -#else - // When building, we need to set the flags for the fsc.exe that we spawned - // so that the errors reported by fsc.exe are in the right locale - projectInstance.SetProperty("LCID", System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString()); -#endif - this.BuildProject.ProjectCollection.HostServices.SetNodeAffinity(projectInstance.FullPath, NodeAffinity.InProc); BuildRequestData requestData = new BuildRequestData(projectInstance, targetsToBuild, this.BuildProject.ProjectCollection.HostServices, BuildRequestDataFlags.ReplaceExistingProjectInstance); submission = BuildManager.DefaultBuildManager.PendBuildRequest(requestData); diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj index d0086462ab..a321847340 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj @@ -22,7 +22,6 @@ $(DefineConstants);CODE_ANALYSIS true v4.6 - $(DefineConstants);FX_PREFERRED_UI_LANG true From bca446d9e44fb0f43ed99da55f6b32bc98b32817 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 29 Jan 2018 19:30:42 +0000 Subject: [PATCH 13/15] Fix the Mono and OSX builds (#4273) * fix build.sh for OSX and a little cleanup * fix build for mono packaging * fix build for mono packaging * disable some tests by default on OSX with build.sh test * fix build from source IVTs --- FSharp.sln | 2 +- Makefile | 4 +- before_install.sh | 2 +- build-everything.proj | 4 +- build.sh | 332 ++---------------- build/targets/GitHash.props | 2 +- mono/appveyor.ps1 | 2 +- netci.groovy | 48 ++- packages.config | 4 + scripts/dotnet-install.sh | 0 src/FSharpSource.Profiles.targets | 1 + src/FSharpSource.Settings.targets | 18 +- src/FSharpSource.targets | 91 ++--- .../FSharp.Build/FSharp.Build.fsproj | 1 - ...Sharp.Compiler.Interactive.Settings.fsproj | 1 - .../FSharp.Compiler.Private.fsproj | 3 - src/buildfromsource/Fsc/Fsc.fsproj | 1 - .../FSharp.Build-proto.fsproj | 16 +- src/fsharp/FSharp.Build/FSharp.Build.fsproj | 18 +- .../InternalsVisibleTo.fs | 10 - .../FSharp.Compiler.Private.fsproj | 10 +- src/fsharp/FSharp.Core/FSharp.Core.fsproj | 2 +- src/fsharp/Fsc-proto/Fsc-proto.fsproj | 7 +- src/fsharp/fscmain.fs | 9 +- src/fsharp/fsi/fsimain.fs | 14 +- src/fsharp/test.snk | Bin 0 -> 596 bytes src/utils/HashMultiMap.fs | 20 ++ src/utils/ResizeArray.fs | 8 + src/utils/TaggedCollections.fsi | 8 +- .../FSharp.Build.UnitTests.fsproj | 16 + .../ProductVersion.fs | 28 +- .../FSharp.Core.Unittests.fsproj | 4 +- .../Microsoft.FSharp.Control/AsyncModule.fs | 8 +- 33 files changed, 262 insertions(+), 432 deletions(-) mode change 100644 => 100755 scripts/dotnet-install.sh delete mode 100644 src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs create mode 100644 src/fsharp/test.snk diff --git a/FSharp.sln b/FSharp.sln index 0d41f990d7..9a3f8f5e6f 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -31,7 +31,7 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite", EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.Unittests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{3881429D-A97A-49EB-B7AE-A82BA5FE9C77}" EndProject diff --git a/Makefile b/Makefile index d955b9e758..b392dfe356 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include $(topsrcdir)mono/config.make -.PHONY: restore +.PHONY: restore build restore: MONO_ENV_OPTIONS=$(monoopts) mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config @@ -27,7 +27,7 @@ build: MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsi/Fsi.fsproj MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj - MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj + MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj mkdir -p $(Configuration)/fsharp30/net40/bin mkdir -p $(Configuration)/fsharp31/net40/bin mkdir -p $(Configuration)/fsharp40/net40/bin diff --git a/before_install.sh b/before_install.sh index d1498a55e6..10f623a6b0 100755 --- a/before_install.sh +++ b/before_install.sh @@ -32,7 +32,7 @@ fi # We need to run the command twice -- on some systems (e.g. macOS) the certs are installed in the user store, # and on other systems (e.g., Ubuntu) they're installed to the machine store. certmgr only shows what's in # the selected store, which is why we need to check both. -if [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then +if [ $OS = 'Linux' ] && [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then echo "No SSL certificates installed so unable to restore NuGet packages." >&2; echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2; exit 1 diff --git a/build-everything.proj b/build-everything.proj index f236cde62c..0d0cdea76c 100644 --- a/build-everything.proj +++ b/build-everything.proj @@ -54,12 +54,12 @@ - + - + diff --git a/build.sh b/build.sh index 2d15c1a934..7c4c450c83 100755 --- a/build.sh +++ b/build.sh @@ -24,12 +24,11 @@ Build and run a subset of test suites Usage: -build.sh ^ +build.sh ^ ^ - ^ ^ ^ - ^ + ^ ^ ^ @@ -41,15 +40,11 @@ Other examples: build.sh net40 (build compiler for .NET Framework) build.sh coreclr (build compiler for .NET Core) - build.sh vs (build Visual Studio IDE Tools) build.sh all (build everything) build.sh test (build and test default targets) build.sh net40 test (build and test net40) build.sh coreclr test (build and test net40) - build.sh vs test (build and test net40) build.sh all test (build and test net40) - build.sh nobuild test include Conformance (run only tests marked with Conformance category) - build.sh nobuild test include Expensive (run only tests marked with Expensive category) " @@ -84,8 +79,6 @@ export BUILD_PHASE=1 export BUILD_NET40_FSHARP_CORE=0 export BUILD_NET40=0 export BUILD_CORECLR=0 -export BUILD_PORTABLE=0 -export BUILD_VS=0 export BUILD_CONFIG=release export BUILD_CONFIG_LOWERCASE=release export BUILD_DIAG= @@ -94,11 +87,8 @@ export BUILD_PUBLICSIGN=0 export TEST_NET40_COMPILERUNIT_SUITE=0 export TEST_NET40_COREUNIT_SUITE=0 export TEST_NET40_FSHARP_SUITE=0 -export TEST_NET40_FSHARPQA_SUITE=0 export TEST_CORECLR_COREUNIT_SUITE=0 export TEST_CORECLR_FSHARP_SUITE=0 -export TEST_PORTABLE_COREUNIT_SUITE=0 -export TEST_VS_IDEUNIT_SUITE=0 export INCLUDE_TEST_SPEC_NUNIT= export INCLUDE_TEST_TAGS= @@ -123,19 +113,6 @@ do export BUILD_PROTO_WITH_CORECLR_LKG=1 export BUILD_CORECLR=1 ;; - "pcls") - _autoselect=0 - export BUILD_PORTABLE=1 - ;; - "vs") - _autoselect=0 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_VS=1 - ;; - "vstest") - export TEST_VS_IDEUNIT_SUITE=1 - ;; "nobuild") export BUILD_PHASE=0 ;; @@ -151,88 +128,11 @@ do export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 - export BUILD_SETUP=$FSC_BUILD_SETUP - export CI=1 - ;; - "microbuild") - _autoselect=0 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 export BUILD_VS=1 export BUILD_SETUP=$FSC_BUILD_SETUP - - export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_CORECLR_COREUNIT_SUITE=0 - export TEST_CORECLR_FSHARP_SUITE=0 - export TEST_PORTABLE_COREUNIT_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - export CI=1 - ;; - - # These divide 'ci' into multiple chunks which can be done in parallel - "ci_part1") - _autoselect=0 - - # what we do - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 - export BUILD_SETUP=$FSC_BUILD_SETUP - export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - export CI=1 - ;; - "ci_part2") - _autoselect=0 - - # what we do - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 - export CI=1 - ;; - "ci_part3") - _autoselect=0 - - # what we do - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_CORECLR=1 - - export TEST_CORECLR_FSHARP_SUITE=1 - export TEST_CORECLR_COREUNIT_SUITE=1 export CI=1 ;; - # TEMP: The Jenkins builds currently call this script with the 'ci' target, - # but that doesn't exist even in build.cmd. It wasn't doing anything - # before anyway, so accept 'ci' but ignore it for now because the test - # suites don't build correctly on Linux/macOS yet anyway. - "ci") - # TODO: Do everything from ci_part1-3 here. - printf "The 'ci' target is currently ignored, until the test suite builds can be fixed for Linux/macOS.\n" - ;; - "proto") export BUILD_PROTO=1 ;; @@ -254,12 +154,6 @@ do "no-test") no_test=1 ;; - "include") - failwith "The 'include' option is not (yet) supported by this script." - #export /a counter=!counter!+1 - #if '$INCLUDE_TEST_SPEC_NUNIT' == '' ( export INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 ) else (set INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 or $INCLUDE_TEST_SPEC_NUNIT ) - #if '$INCLUDE_TEST_TAGS' == '' ( export INCLUDE_TEST_TAGS=$ARG2 ) else (set INCLUDE_TEST_TAGS=$ARG2;$INCLUDE_TEST_TAGS ) - ;; "test-all") _autoselect=0 export BUILD_PROTO=1 @@ -267,23 +161,12 @@ do export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 export BUILD_SETUP=$FSC_BUILD_SETUP export TEST_NET40_COMPILERUNIT_SUITE=1 export TEST_NET40_COREUNIT_SUITE=1 export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 export TEST_CORECLR_COREUNIT_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - ;; - "test-net40-fsharpqa") - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - export TEST_NET40_FSHARPQA_SUITE=1 ;; "test-compiler-unit") export BUILD_NET40=1 @@ -299,14 +182,9 @@ do export BUILD_CORECLR=1 export TEST_CORECLR_COREUNIT_SUITE=1 ;; - "test-pcl-coreunit") - export BUILD_PORTABLE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 - ;; "test-net40-fsharp") export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 export TEST_NET40_FSHARP_SUITE=1 ;; "test-coreclr-fsharp") @@ -329,50 +207,43 @@ do esac done -if [ $_buildexit -eq 1 ]; then +if [ "$_buildexit" = "1" ]; then exit $_buildexitvalue fi # Apply defaults, if necessary. -if [ $_autoselect -eq 1 ]; then +if [ "$_autoselect" = "1" ]; then export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 fi -if [ $_autoselect_tests -eq 1 ]; then - if [ $BUILD_NET40 -eq 1 ]; then +if [ "$_autoselect_tests" = "1" ]; then + if [ "$BUILD_NET40" = "1" ]; then export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 + + # This requires a build of FSharp.Core.dll? + # export TEST_NET40_COREUNIT_SUITE=1 + + # This requires a lot more work to get running on OSX/Linux + # export TEST_NET40_FSHARP_SUITE=1 fi - if [ $BUILD_CORECLR -eq 1 ]; then + if [ "$BUILD_CORECLR" = "1" ]; then export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export TEST_CORECLR_FSHARP_SUITE=1 export TEST_CORECLR_COREUNIT_SUITE=1 fi - if [ $BUILD_PORTABLE -eq 1 ]; then - export TEST_PORTABLE_COREUNIT_SUITE=1 - fi - - if [ $BUILD_VS -eq 1 ]; then - export TEST_VS_IDEUNIT_SUITE=1 - fi fi # If the `PB_SKIPTESTS` variable is set to 'true' then no tests should be built or run, even if explicitly specified -if [ $PB_SKIPTESTS -eq "true" ]; then +if [ "$PB_SKIPTESTS" = "true" ]; then export TEST_NET40_COMPILERUNIT_SUITE=0 export TEST_NET40_COREUNIT_SUITE=0 export TEST_NET40_FSHARP_SUITE=0 - export TEST_NET40_FSHARPQA_SUITE=0 export TEST_CORECLR_COREUNIT_SUITE=0 export TEST_CORECLR_FSHARP_SUITE=0 - export TEST_PORTABLE_COREUNIT_SUITE=0 - export TEST_VS_IDEUNIT_SUITE=0 fi # @@ -386,8 +257,6 @@ printf "BUILD_PROTO_WITH_CORECLR_LKG=%s\n" "$BUILD_PROTO_WITH_CORECLR_LKG" printf "BUILD_NET40=%s\n" "$BUILD_NET40" printf "BUILD_NET40_FSHARP_CORE=%s\n" "$BUILD_NET40_FSHARP_CORE" printf "BUILD_CORECLR=%s\n" "$BUILD_CORECLR" -printf "BUILD_PORTABLE=%s\n" "$BUILD_PORTABLE" -printf "BUILD_VS=%s\n" "$BUILD_VS" printf "BUILD_SETUP=%s\n" "$BUILD_SETUP" printf "BUILD_CONFIG=%s\n" "$BUILD_CONFIG" printf "BUILD_PUBLICSIGN=%s\n" "$BUILD_PUBLICSIGN" @@ -398,21 +267,12 @@ printf "\n" printf "TEST_NET40_COMPILERUNIT_SUITE=%s\n" "$TEST_NET40_COMPILERUNIT_SUITE" printf "TEST_NET40_COREUNIT_SUITE=%s\n" "$TEST_NET40_COREUNIT_SUITE" printf "TEST_NET40_FSHARP_SUITE=%s\n" "$TEST_NET40_FSHARP_SUITE" -printf "TEST_NET40_FSHARPQA_SUITE=%s\n" "$TEST_NET40_FSHARPQA_SUITE" printf "TEST_CORECLR_COREUNIT_SUITE=%s\n" "$TEST_CORECLR_COREUNIT_SUITE" printf "TEST_CORECLR_FSHARP_SUITE=%s\n" "$TEST_CORECLR_FSHARP_SUITE" -printf "TEST_PORTABLE_COREUNIT_SUITE=%s\n" "$TEST_PORTABLE_COREUNIT_SUITE" -printf "TEST_VS_IDEUNIT_SUITE=%s\n" "$TEST_VS_IDEUNIT_SUITE" printf "INCLUDE_TEST_SPEC_NUNIT=%s\n" "$INCLUDE_TEST_SPEC_NUNIT" printf "INCLUDE_TEST_TAGS=%s\n" "$INCLUDE_TEST_TAGS" printf "\n" -# TODO: Print out environment variables? -printf "Environment\n" -printf "\n" -printf "(TODO)\n" -printf "\n" -printf "\n" build_status "Done with arguments, starting preparation" @@ -422,7 +282,7 @@ msbuildflags="" # Perform any necessary setup and system configuration prior to running builds. ./before_install.sh rc=$?; -if [ $rc -ne 0 ]; then +if [ "$rc" != "0" ]; then printf "before_install script failed.\n" exit $rc fi @@ -458,23 +318,10 @@ if [ "${RestorePackages:-true}" = 'true' ]; then failwith "Nuget restore failed" fi - if [ "$BUILD_VS" = '1' ]; then - eval "$_nugetexe restore vsintegration/packages.config $_nugetoptions" - if [ $? -ne 0 ]; then - failwith "Nuget restore failed" - fi - fi - - if [ "$BUILD_SETUP" = '1' ]; then - eval "$_nugetexe restore setup/packages.config $_nugetoptions" - if [ $? -ne 0 ]; then - failwith "Nuget restore failed" - fi - fi fi # If building for CoreCLR, restore the Tools directory. -if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then +if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then # Restore the Tools directory ./init-tools.sh rc=$?; @@ -497,10 +344,10 @@ _dotnetexe=dotnet _architecture=win7-x64 # Build Proto -if [ "$BUILD_PROTO" = '1' ]; then +if [ "$BUILD_PROTO" = "1" ]; then rm -rfd Proto - if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then + if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then { pushd ./lkg/fsc && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed" { pushd ./lkg/fsi && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed" @@ -512,58 +359,26 @@ if [ "$BUILD_PROTO" = '1' ]; then # { printeval "$_ngenexe install Proto/net40/bin/fsc-proto.exe /nologo"; } || failwith "NGen of proto failed" else # Build proto-compiler and libs - { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:UseMonoPackaging=true /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed" + { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed" fi fi build_status "Done with proto, starting build" -if [ "$BUILD_PHASE" = '1' ]; then - cmd="$_msbuildexe $msbuildflags build-everything.proj /p:UseMonoPackaging=true /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN" +if [ "$BUILD_PHASE" = "1" ]; then + cmd="$_msbuildexe $msbuildflags build-everything.proj /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN" { printeval "$cmd"; } || failwith "'$cmd' failed" fi -build_status "Main part of build finished, completing parts of build needed for Mono setup" - -if [ "$BUILD_NET40" = '1' ]; then - { printeval "./autogen.sh --prefix=/usr"; } || failwith "./autogen.sh failed" - - { printeval "make"; } || failwith "make failed" -fi - -build_status "Done with build, starting update/prepare" - -if [ "$BUILD_NET40" = '1' ]; then - - { printeval "sudo make install"; } || failwith "sudo make install failed" - -# WINDOWS: -# src/update.sh $BUILD_CONFIG -# rc=$?; -# if [ $rc -ne 0 ]; then -# printf "src/update script failed.\n" -# exit $rc -# fi -fi - -NUNITPATH="packages/NUnit.Console.3.0.0/tools/" -printf "set NUNITPATH=%s\n" "$NUNITPATH" -if [ ! -d "$NUNITPATH" ]; then - failwith "Could not find $NUNITPATH" -fi - -{ printeval "cp -R $NUNITPATH ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa" -{ printeval "cp -R ${_scriptdir}tests/fsharpqa/testenv/src/nunit ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa" - -# TODO: Define location of ildasm/monodis and sn - -if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '0' ] && [ "$TEST_PORTABLE_COREUNIT_SUITE" = '0' ] && [ "$TEST_CORECLR_COREUNIT_SUITE" = '0' ] && [ "$TEST_VS_IDEUNIT_SUITE" = '0' ] && [ "$TEST_NET40_FSHARP_SUITE" = '0' ] && [ "$TEST_NET40_FSHARPQA_SUITE" = '0' ]; then +if [ "$TEST_NET40_COMPILERUNIT_SUITE" != "1" ] && [ "$TEST_CORECLR_COREUNIT_SUITE" != "1" ] && [ "$TEST_NET40_FSHARP_SUITE" != "1" ]; then # Successful build; not running tests so exit now. exit 0 fi -if [ $no_test -eq 1 ]; then +NUNITPATH="packages/NUnit.Console.3.0.0/tools/" + +if [ "$no_test" = "1" ]; then # Successful build; not running tests so exit now. exit 0 fi @@ -580,15 +395,7 @@ fi printf "WHERE_ARG_NUNIT=%s\n" "$WHERE_ARG_NUNIT" -export NUNITPATH="tests/fsharpqa/testenv/bin/nunit/" export NUNIT3_CONSOLE="${NUNITPATH}nunit3-console.exe" -export link_exe="${_scriptdir}packages/VisualCppTools.14.0.24519-Pre/lib/native/bin/link.exe" -if [ ! -f "$link_exe" ]; then - failwith "failed to find '$link_exe' use nuget to restore the VisualCppTools package" -fi - -#if /I not '$single_threaded' == 'true' (set PARALLEL_ARG=-procs:$NUMBER_OF_PROCESSORS) else set PARALLEL_ARG=-procs:0 - export FSCBINPATH="${_scriptdir}$BUILD_CONFIG/net40/bin" export RESULTSDIR="${_scriptdir}tests/TestResults" if [ ! -d "$RESULTSDIR" ]; then @@ -597,19 +404,18 @@ fi printf "FSCBINPATH=%s\n" "$FSCBINPATH" printf "RESULTSDIR=%s\n" "$RESULTSDIR" -printf "link_exe=%s\n" "$link_exe" printf "NUNIT3_CONSOLE=%s\n" "$NUNIT3_CONSOLE" printf "NUNITPATH=%s\n" "$NUNITPATH" # ---------------- net40-fsharp ----------------------- -if [ "$TEST_NET40_FSHARP_SUITE" = '1' ]; then +if [ "$TEST_NET40_FSHARP_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="" XMLFILE="$RESULTSDIR/test-net40-fsharp-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then OUTPUTFILE="$RESULTSDIR/test-net40-fsharp-output.log" OUTPUTARG="--output:\"$OUTPUTFILE\"" ERRORFILE="$RESULTSDIR/test-net40-fsharp-errors.log" @@ -630,14 +436,14 @@ fi # ---------------- net40-compilerunit ----------------------- -if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '1' ]; then +if [ "$TEST_NET40_COMPILERUNIT_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="$RESULTSDIR/test-net40-compilerunit-errors.log" XMLFILE="$RESULTSDIR/test-net40-compilerunit-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then OUTPUTFILE="$RESULTSDIR/test-net40-compilerunit-output.log" ERRORARG="--err:\"$ERRORFILE\"" OUTPUTARG="--output:\"$OUTPUTFILE\"" @@ -661,14 +467,14 @@ fi # ---------------- net40-coreunit ----------------------- -if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then +if [ "$TEST_NET40_COREUNIT_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="" XMLFILE="$RESULTSDIR/test-net40-coreunit-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then ERRORFILE="$RESULTSDIR/test-net40-coreunit-errors.log" OUTPUTFILE="$RESULTSDIR/test-net40-coreunit-output.log" ERRORARG="--err:\"$ERRORFILE\"" @@ -691,42 +497,10 @@ if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then fi fi -# ---------------- portable-coreunit ----------------------- - -if [ "$TEST_PORTABLE_COREUNIT_SUITE" = '1' ]; then - - OUTPUTARG="" - ERRORARG="" - OUTPUTFILE="" - ERRORFILE="" - XMLFILE="$RESULTSDIR/test-portable-coreunit-results.xml" - - if [ "$CI" = '1' ]; then - OUTPUTFILE="$RESULTSDIR/test-portable-coreunit-output.log" - ERRORFILE="$RESULTSDIR/test-portable-coreunit-errors.log" - ERRORARG="--err:\"$ERRORFILE\"" - OUTPUTARG="--output:\"$OUTPUTFILE\"" - fi - - if ! printeval "mono $NUNIT3_CONSOLE /framework:V4.0 /result=\"$XMLFILE;format=nunit3\" $OUTPUTARG $ERRORARG /work=\"$FSCBINPATH\" \"$FSCBINPATH/../../portable7/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable47/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable78/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable259/bin/FSharp.Core.UnitTests.dll\" $WHERE_ARG_NUNIT"; then - if [ -f "$OUTPUTFILE" ]; then - echo ----------------------------------------------------------------- - cat "$OUTPUTFILE" - fi - if [ -f "$ERRORFILE" ]; then - echo ----------------------------------------------------------------- - cat "$ERRORFILE" - fi - echo ----------------------------------------------------------------- - echo Error: Running tests portable-coreunit failed, see logs above -- FAILED - echo ----------------------------------------------------------------- - exit 1 - fi -fi # ---------------- coreclr-coreunit ----------------------- -if [ "$TEST_CORECLR_COREUNIT_SUITE" = '1' ]; then +if [ "$TEST_CORECLR_COREUNIT_SUITE" = "1" ]; then XMLFILE="$RESULTSDIR/test-coreclr-coreunit-results.xml" OUTPUTFILE="$RESULTSDIR/test-coreclr-coreunit-output.log" @@ -742,7 +516,7 @@ fi # ---------------- coreclr-fsharp ----------------------- -if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then +if [ "$TEST_CORECLR_FSHARP_SUITE" = "1" ]; then export single_threaded=true export permutations=FSC_CORECLR @@ -760,43 +534,3 @@ if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then fi fi -# ---------------- net40-fsharpqa ----------------------- - -OSARCH="${PROCESSOR_ARCHITECTURE:-x64}" - -# Set this to 1 in order to use an external compiler host process -# This only has an effect when running the FSHARPQA tests, but can -# greatly speed up execution since fsc.exe does not need to be spawned thousands of times -HOSTED_COMPILER=1 - -if [ "$TEST_NET40_FSHARPQA_SUITE" = '1' ]; then - - export FSC="$FSCBINPATH/fsc.exe" - export FSCOREDLLPATH="$FSCBINPATH/FSharp.Core.dll" - export PATH="$FSCBINPATH;$PATH" - - if ! command -v perl > /dev/null; then - failwith "perl is not in the PATH, it is required for the net40-fsharpqa test suite" - fi - - OUTPUTFILE=test-net40-fsharpqa-results.log - ERRORFILE=test-net40-fsharpqa-errors.log - FAILENV=test-net40-fsharpqa-errors - - { pushd "${_scriptdir}tests/fsharpqa/source" && \ - printeval "perl tests/fsharpqa/testenv/bin/runall.pl -resultsroot $RESULTSDIR -results $OUTPUTFILE -log $ERRORFILE -fail $FAILENV -cleanup:no $TTAGS_ARG_RUNALL $PARALLEL_ARG" && \ - popd; } || { - if [ -f "$RESULTSDIR/$OUTPUTFILE" ]; then - echo ----------------------------------------------------------------- - cat "$RESULTSDIR/$OUTPUTFILE" - fi - if [ -f "$RESULTSDIR/$ERRORFILE" ]; then - echo ----------------------------------------------------------------- - cat "$RESULTSDIR/$ERRORFILE" - fi - echo ----------------------------------------------------------------- - echo Error: Running tests net40-fsharpqa failed, see logs above -- FAILED - echo ----------------------------------------------------------------- - exit 1 - } -fi diff --git a/build/targets/GitHash.props b/build/targets/GitHash.props index 817240dbca..e03e736e51 100644 --- a/build/targets/GitHash.props +++ b/build/targets/GitHash.props @@ -5,7 +5,7 @@ Copied from RepoToolset. Might be slightly modified to adjust for the current F# build system specifics if necessary. --> - + diff --git a/scripts/dotnet-install.sh b/scripts/dotnet-install.sh old mode 100644 new mode 100755 diff --git a/src/FSharpSource.Profiles.targets b/src/FSharpSource.Profiles.targets index 274cbf5108..8bcc8aa5f2 100644 --- a/src/FSharpSource.Profiles.targets +++ b/src/FSharpSource.Profiles.targets @@ -3,6 +3,7 @@ + $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);BE_SECURITY_TRANSPARENT $(DefineConstants);FX_LCIDFROMCODEPAGE diff --git a/src/FSharpSource.Settings.targets b/src/FSharpSource.Settings.targets index 35086a642f..ee3810db64 100644 --- a/src/FSharpSource.Settings.targets +++ b/src/FSharpSource.Settings.targets @@ -98,19 +98,27 @@ $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45 $(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\ + true + + true true 0.2.0-beta-000076 + + + false + true true $(FSharpSourcesRoot)\fsharp\msft.pubkey true true - + + true false true @@ -130,6 +138,7 @@ full + portable false prompt @@ -142,6 +151,7 @@ pdbonly + portable true false @@ -153,6 +163,7 @@ full + portable true DEBUG;NO_STRONG_NAMES;$(DefineConstants) @@ -196,6 +207,11 @@ $(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools + + + + 14.0.0.0 + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index c3f6de5505..206259ae08 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -8,74 +8,43 @@ - - - - false - true - - - - - - - - - true - false - fs - - - - - - - true - true - fs - - - - - - - - true - $(FSharpSourcesRoot)\fsharp\msft.pubkey - true - true - fs - - - - - - - - NO_STRONG_NAMES;$(DefineConstants) - fs - - - + + fs + - - $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)" + + + + true + false + false + NO_STRONG_NAMES;$(DefineConstants) - - $(IntermediateOutputPath)source_link.json + + + $(FSharpSourcesRoot)\fsharp\test.snk + false + STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants) - - NO_STRONG_NAMES;$(DefineConstants) + + + $(FSCoreVersion) + $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)" + + + + $(IntermediateOutputPath)source_link.json + MSBUILD_AT_LEAST_14;$(DefineConstants) + - false @@ -126,7 +95,8 @@ fsharp30\$(TargetDotnetProfile) fsharp31\$(TargetDotnetProfile) fsharp40\$(TargetDotnetProfile) - obj\$(TargetFrameworkOutputDirectory)\ + $(TargetDotnetProfile) + obj\$(Configuration)\$(TargetFrameworkOutputDirectory)\ @@ -380,9 +350,14 @@ - + + <_PublicKey>002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293 + + + <_PublicKey>002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee + <_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute"> <_Parameter1 Condition="'%(InternalsVisibleTo.Key)' != ''">%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.Key) diff --git a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj index 4fe08c815b..f49ecb7338 100644 --- a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj +++ b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj @@ -17,7 +17,6 @@ FSBuild.resx - diff --git a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 7cea584c57..406efaf8a0 100644 --- a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -18,7 +18,6 @@ FSInteractiveSettings.resx - diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index ef26074ad5..655cfa8114 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -608,9 +608,6 @@ InteractiveSession\fsi.fs - - Misc/InternalsVisibleTo.fs - Misc/MSBuildReferenceResolver.fs diff --git a/src/buildfromsource/Fsc/Fsc.fsproj b/src/buildfromsource/Fsc/Fsc.fsproj index 5ee390de33..58b44242fd 100644 --- a/src/buildfromsource/Fsc/Fsc.fsproj +++ b/src/buildfromsource/Fsc/Fsc.fsproj @@ -15,7 +15,6 @@ - Resources/AssemblyInfo.fs diff --git a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj index 8aba433807..8ab9e33c93 100644 --- a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj +++ b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj @@ -72,7 +72,7 @@ - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -90,5 +90,19 @@ FSharp.Core + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index e432279f74..a24d03a6ac 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -53,13 +53,13 @@ - + - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -73,6 +73,20 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Tasks.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + {DED3BBD7-53F4-428A-8C9F-27968E768605} diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs b/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs deleted file mode 100644 index 3071a74b61..0000000000 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp -open System.Reflection -[] -[] -[] - -do() - diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index e871d61d4c..0d135f2ee1 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -642,17 +642,17 @@ FSIstrings.txt - InteractiveSession\fsi.fsi + InteractiveSession/fsi.fsi - InteractiveSession\fsi.fs + InteractiveSession/fsi.fs - + Misc/MSBuildReferenceResolver.fs - + Misc/LegacyHostedCompilerForTesting.fs @@ -684,6 +684,8 @@ ..\..\..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll true + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index f24ede9f1b..32c5f01530 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -34,7 +34,7 @@ PreserveNewest - + false diff --git a/src/fsharp/Fsc-proto/Fsc-proto.fsproj b/src/fsharp/Fsc-proto/Fsc-proto.fsproj index fd3d209e51..8c49f5fcf6 100644 --- a/src/fsharp/Fsc-proto/Fsc-proto.fsproj +++ b/src/fsharp/Fsc-proto/Fsc-proto.fsproj @@ -438,7 +438,10 @@ fsc.fs - + + Service/SimulatedMSBuildReferenceResolver.fs + + MSBuildReferenceResolver.fs @@ -473,7 +476,7 @@ FSharp.Core - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll diff --git a/src/fsharp/fscmain.fs b/src/fsharp/fscmain.fs index 9405af123b..344656d6b5 100644 --- a/src/fsharp/fscmain.fs +++ b/src/fsharp/fscmain.fs @@ -48,7 +48,14 @@ module Driver = failwithf "%s" <| FSComp.SR.elSysEnvExitDidntExit() } - mainCompile (ctok, argv, MSBuildReferenceResolver.Resolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None) + let legacyReferenceResolver = +#if CROSS_PLATFORM_COMPILER + SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver +#else + MSBuildReferenceResolver.Resolver +#endif + + mainCompile (ctok, argv, legacyReferenceResolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None) 0 [] diff --git a/src/fsharp/fsi/fsimain.fs b/src/fsharp/fsi/fsimain.fs index b87c795a60..002cfa54a4 100644 --- a/src/fsharp/fsi/fsimain.fs +++ b/src/fsharp/fsi/fsimain.fs @@ -235,6 +235,12 @@ let evaluateSession(argv: string[]) = None #endif + let legacyReferenceResolver = +#if CROSS_PLATFORM_COMPILER + SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver +#else + MSBuildReferenceResolver.Resolver +#endif // Update the configuration to include 'StartServer', WinFormsEventLoop and 'GetOptionalConsoleReadLine()' let rec fsiConfig = { new FsiEvaluationSessionHostConfig () with @@ -251,21 +257,21 @@ let evaluateSession(argv: string[]) = member __.ReportUserCommandLineArgs args = fsiConfig0.ReportUserCommandLineArgs args member __.EventLoopRun() = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).Run() | _ -> #endif fsiConfig0.EventLoopRun() member __.EventLoopInvoke(f) = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).Invoke(f) | _ -> #endif fsiConfig0.EventLoopInvoke(f) member __.EventLoopScheduleRestart() = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).ScheduleRestart() | _ -> #endif @@ -279,7 +285,7 @@ let evaluateSession(argv: string[]) = member __.GetOptionalConsoleReadLine(probe) = getConsoleReadLine(probe) } // Create the console - and fsiSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=MSBuildReferenceResolver.Resolver) + and fsiSession : FsiEvaluationSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=legacyReferenceResolver) #if !FX_NO_WINFORMS diff --git a/src/fsharp/test.snk b/src/fsharp/test.snk new file mode 100644 index 0000000000000000000000000000000000000000..c16543bdc485c87204265be7cdb36b9e04f769a2 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Z(=G%(7)~F0J6@jCsIiOQd z98SABxJRb8V`-2gN(9eK(XPcF&csac$dWF#yDsKl!~2`6hv7j4ESAnePnfSWP>g;g z+O@D~s(>$MlZX{J?hgF5)A7lw_#s-vE|R*MS^`&1Xpqo!WXmrziv&9yPyU$i;A!qF zarRTR&+82LmEk+&s6JGD4YW8k^p;aj@0EH@$-2i<35?*NiXgU%>3c|8|J6s>t-_72 z$AKmHe;`zoX*Bxf$o6Byt`-DDJoNdFH7R+VhwI`VL~7 z>`TMSZslV~Io8Ltfl-4!k+xBs6r(%B#*{jL=5e-@)>)R9^8L%] type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) = + let firstEntries = Dictionary<_,_>(n,hasheq) + let rest = Dictionary<_,_>(3,hasheq) new (hasheq : IEqualityComparer<'Key>) = HashMultiMap<'Key,'Value>(11, hasheq) + new (seq : seq<'Key * 'Value>, hasheq : IEqualityComparer<'Key>) as x = new HashMultiMap<'Key,'Value>(11, hasheq) then seq |> Seq.iter (fun (k,v) -> x.Add(k,v)) @@ -35,7 +38,9 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) rest.Clear() member x.FirstEntries = firstEntries + member x.Rest = rest + member x.Copy() = let res = HashMultiMap<'Key,'Value>(firstEntries.Count,firstEntries.Comparer) for kvp in firstEntries do @@ -114,6 +119,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) member x.Count = firstEntries.Count interface IEnumerable> with + member s.GetEnumerator() = let elems = List<_>(firstEntries.Count + rest.Count) for kvp in firstEntries do @@ -123,34 +129,48 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) (elems.GetEnumerator() :> IEnumerator<_>) interface System.Collections.IEnumerable with + member s.GetEnumerator() = ((s :> seq<_>).GetEnumerator() :> System.Collections.IEnumerator) interface IDictionary<'Key, 'Value> with + member s.Item with get x = s.[x] and set x v = s.[x] <- v member s.Keys = ([| for kvp in s -> kvp.Key |] :> ICollection<'Key>) + member s.Values = ([| for kvp in s -> kvp.Value |] :> ICollection<'Value>) + member s.Add(k,v) = s.[k] <- v + member s.ContainsKey(k) = s.ContainsKey(k) + member s.TryGetValue(k,r) = if s.ContainsKey(k) then (r <- s.[k]; true) else false + member s.Remove(k:'Key) = let res = s.ContainsKey(k) in s.Remove(k); res interface ICollection> with + member s.Add(x) = s.[x.Key] <- x.Value + member s.Clear() = s.Clear() + member s.Remove(x) = let res = s.ContainsKey(x.Key) if res && Unchecked.equals s.[x.Key] x.Value then s.Remove(x.Key); res + member s.Contains(x) = s.ContainsKey(x.Key) && Unchecked.equals s.[x.Key] x.Value + member s.CopyTo(arr,arrIndex) = s |> Seq.iteri (fun j x -> arr.[arrIndex+j] <- x) + member s.IsReadOnly = false + member s.Count = s.Count diff --git a/src/utils/ResizeArray.fs b/src/utils/ResizeArray.fs index b8720222de..6661304434 100644 --- a/src/utils/ResizeArray.fs +++ b/src/utils/ResizeArray.fs @@ -10,9 +10,13 @@ open Microsoft.FSharp.Core.OptimizedClosures module internal ResizeArray = let length (arr: ResizeArray<'T>) = arr.Count + let get (arr: ResizeArray<'T>) (n: int) = arr.[n] + let set (arr: ResizeArray<'T>) (n: int) (x:'T) = arr.[n] <- x + let create (n: int) x = new ResizeArray<_> (seq { for _ in 1 .. n -> x }) + let init (n: int) (f: int -> 'T) = new ResizeArray<_> (seq { for i in 0 .. n-1 -> f i }) let blit (arr1: ResizeArray<'T>) start1 (arr2: ResizeArray<'T>) start2 len = @@ -25,6 +29,7 @@ module internal ResizeArray = arr2.[start2+i] <- arr1.[start1 + i] let concat (arrs: ResizeArray<'T> list) = new ResizeArray<_> (seq { for arr in arrs do for x in arr do yield x }) + let append (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T>) = concat [arr1; arr2] let sub (arr: ResizeArray<'T>) start len = @@ -176,10 +181,13 @@ module internal ResizeArray = res let toArray (arr: ResizeArray<'T>) = arr.ToArray() + let ofArray (arr: 'T[]) = new ResizeArray<_>(arr) + let toSeq (arr: ResizeArray<'T>) = Seq.readonly arr let sort f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(f)) + let sortBy f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(fun x y -> compare (f x) (f y))) diff --git a/src/utils/TaggedCollections.fsi b/src/utils/TaggedCollections.fsi index ba99df3376..c877cbe7eb 100644 --- a/src/utils/TaggedCollections.fsi +++ b/src/utils/TaggedCollections.fsi @@ -107,10 +107,13 @@ namespace Internal.Utilities.Collections.Tagged member ToArray: unit -> 'T array interface ICollection<'T> + interface IEnumerable<'T> + interface System.Collections.IEnumerable interface System.IComparable + override Equals : obj -> bool type internal Set<'T> = Set<'T, IComparer<'T>> @@ -128,14 +131,13 @@ namespace Internal.Utilities.Collections.Tagged /// Immutable maps. A constraint tag carries information about the class of key-comparers being used. [] type internal Map<'Key,'Value,'ComparerTag> when 'ComparerTag :> IComparer<'Key> = + /// Return a new map with the binding added to the given map. member Add: 'Key * 'Value -> Map<'Key,'Value,'ComparerTag> /// Return True if there are no bindings in the map. member IsEmpty: bool - //member Comparer : 'ComparerTag - /// The empty map, and use the given comparer comparison function for all operations associated /// with any maps built from this map. static member Empty: 'ComparerTag -> Map<'Key,'Value,'ComparerTag> @@ -213,7 +215,9 @@ namespace Internal.Utilities.Collections.Tagged interface IEnumerable> interface System.Collections.IEnumerable + interface System.IComparable + override Equals : obj -> bool type internal Map<'Key,'Value> = Map<'Key, 'Value, IComparer<'Key>> diff --git a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj index f0cc28128c..0522cf51f5 100644 --- a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj +++ b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -41,6 +41,8 @@ True $(NUnitLibDir)\nunit.framework.dll + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -54,6 +56,20 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Tasks.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + {702A7979-BCF9-4C41-853E-3ADFC9897890} diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index db57334b73..94c87bf0e1 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -1,6 +1,7 @@ namespace FSharp.Compiler.UnitTests open System +open System.IO open System.Text open NUnit.Framework @@ -111,16 +112,19 @@ module TypeProviderDesignTimeComponentLoading = [] let ``check tooling paths for type provider design time component loading`` () = - let expected = - [ @"typeproviders\fsharp41\net461" - @"tools\fsharp41\net461" - @"typeproviders\fsharp41\net452" - @"tools\fsharp41\net452" - @"typeproviders\fsharp41\net451" - @"tools\fsharp41\net451" - @"typeproviders\fsharp41\net45" - @"tools\fsharp41\net45" - @"typeproviders\fsharp41\netstandard2.0" - @"tools\fsharp41\netstandard2.0" ] + let expected = + [ Path.Combine("typeproviders", "fsharp41", "net461") + Path.Combine("tools", "fsharp41", "net461") + Path.Combine("typeproviders", "fsharp41", "net452") + Path.Combine("tools", "fsharp41", "net452") + Path.Combine("typeproviders", "fsharp41", "net451") + Path.Combine("tools", "fsharp41", "net451") + Path.Combine("typeproviders", "fsharp41", "net45") + Path.Combine("tools", "fsharp41", "net45") + Path.Combine("typeproviders", "fsharp41", "netstandard2.0") + Path.Combine("tools", "fsharp41", "netstandard2.0") + ] let actual = Microsoft.FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths() - Assert.areEqual expected actual + printfn "actual = %A" actual + printfn "expected = %A" expected + Assert.True((expected=actual)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj index f1e384f1d6..6dde86b717 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj @@ -118,8 +118,8 @@ - - FSharp.Core.UnitTests.dll.config + + FSharp.Core.Unittests.dll.config FSCoreVersion $(FSCoreVersion) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index 0cc041bdfd..252fa2913f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -612,24 +612,30 @@ type AsyncModule() = x := !x + 1 // Side effect! return "" } - let memFunc = Utils.memoizeAsync <| someSlowFunc + let memFunc : string -> Async = Utils.memoizeAsync <| someSlowFunc async { + Console.WriteLine "Do the same memoized thing many ways...." do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore + + Console.WriteLine "Still more ways...." for _i = 1 to 30 do Async.Start( memFunc "a" |> Async.Ignore ) Async.Start( memFunc "a" |> Async.Ignore ) do! Async.Sleep 500 do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore + Console.WriteLine "Still more ways again...." for _i = 1 to 30 do Async.Start( memFunc "a" |> Async.Ignore ) + Console.WriteLine "Still more ways again again...." do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore } |> Async.RunSynchronously + Console.WriteLine "Checking result...." Assert.AreEqual(1, !x) From 65506e966c381a62750f9f70c4da797178c2415a Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 29 Jan 2018 14:04:21 -0800 Subject: [PATCH 14/15] use dev15.5 for CI builds --- netci.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netci.groovy b/netci.groovy index 7bb90e6b74..c5da454d85 100644 --- a/netci.groovy +++ b/netci.groovy @@ -111,7 +111,7 @@ ${buildPath}build.cmd ${buildFlavor} ${build_args}""") // TODO: set to false after tests are fully enabled def skipIfNoTestFiles = true - def affinity = configuration == 'Release_net40_no_vs' ? 'latest-or-auto' : (os == 'Windows_NT' ? 'latest-or-auto-dev15-0' : 'latest-or-auto') + def affinity = configuration == 'Release_net40_no_vs' ? 'latest-or-auto' : (os == 'Windows_NT' ? 'latest-dev15-5' : 'latest-or-auto') Utilities.setMachineAffinity(newJob, os, affinity) Utilities.standardJobSetup(newJob, project, isPullRequest, "*/${branch}") From e5f1c6fa11f5cb6e3ea6da8f38094aca15d20e6a Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 2 Feb 2018 05:52:57 -0800 Subject: [PATCH 15/15] adapt to latest --- src/fsharp/symbols/Exprs.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index 48153d482a..ba5c187243 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -617,14 +617,14 @@ module FSharpExprConvert = ConvExprPrim cenv env op | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] - when mspec.MethodRef.EnclosingTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> + when mspec.MethodRef.DeclaringTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> let ty = tyOfExpr cenv.g arg let op = mkCallHash cenv.g m ty arg ConvExprPrim cenv env op | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [], [Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)] - when mref.EnclosingTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> + when mref.DeclaringTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> let op = mkCallTypeOf cenv.g m ty ConvExprPrim cenv env op