diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs
index 41b4922a7d0..b4d9acf83f9 100644
--- a/src/Compiler/Checking/PostInferenceChecks.fs
+++ b/src/Compiler/Checking/PostInferenceChecks.fs
@@ -85,9 +85,6 @@ type env =
/// "module remap info", i.e. hiding information down the signature chain, used to compute what's hidden by a signature
sigToImplRemapInfo: (Remap * SignatureHidingInfo) list
- /// Constructor limited - are we in the prelude of a constructor, prior to object initialization
- ctorLimitedZone: bool
-
/// Are we in a quotation?
quote : bool
@@ -1143,7 +1140,7 @@ and CheckExpr (cenv: cenv) (env: env) origExpr (ctxt: PermitByRefExpr) : Limit =
| Expr.Sequential (e1, e2, ThenDoSeq, _) ->
CheckExprNoByrefs cenv env e1
- CheckExprNoByrefs cenv {env with ctorLimitedZone=false} e2
+ CheckExprNoByrefs cenv env e2
NoLimit
| Expr.Const (_, m, ty) ->
@@ -1425,9 +1422,6 @@ and CheckNoResumableStmtConstructs cenv _env expr =
and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
let g = cenv.g
- let ctorLimitedZoneCheck() =
- if env.ctorLimitedZone then errorR(Error(FSComp.SR.chkObjCtorsCantUseExceptionHandling(), m))
-
// Ensure anonymous record type requirements are recorded
match op with
| TOp.AnonRecdGet (anonInfo, _)
@@ -1444,7 +1438,6 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
| TOp.TryFinally _, [_], [Expr.Lambda (_, _, _, [_], e1, _, _); Expr.Lambda (_, _, _, [_], e2, _, _)] ->
CheckTypeInstNoInnerByrefs cenv env m tyargs // result of a try/finally can be a byref
- ctorLimitedZoneCheck()
let limit = CheckExpr cenv env e1 ctxt // result of a try/finally can be a byref if in a position where the overall expression is can be a byref
CheckExprNoByrefs cenv env e2
limit
@@ -1455,7 +1448,6 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
| TOp.TryWith _, [_], [Expr.Lambda (_, _, _, [_], e1, _, _); Expr.Lambda (_, _, _, [_], _e2, _, _); Expr.Lambda (_, _, _, [_], e3, _, _)] ->
CheckTypeInstNoInnerByrefs cenv env m tyargs // result of a try/catch can be a byref
- ctorLimitedZoneCheck()
let limit1 = CheckExpr cenv env e1 ctxt // result of a try/catch can be a byref if in a position where the overall expression is can be a byref
// [(* e2; -- don't check filter body - duplicates logic in 'catch' body *) e3]
let limit2 = CheckExpr cenv env e3 ctxt // result of a try/catch can be a byref if in a position where the overall expression is can be a byref
@@ -2010,8 +2002,6 @@ and CheckBinding cenv env alwaysCheckNoReraise ctxt (TBind(v, bindRhs, _) as bin
let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.DeclaringEntity.CompilationPath) v.Accessibility
CheckTypeForAccess cenv env (fun () -> NicePrint.stringOfQualifiedValOrMember cenv.denv cenv.infoReader vref) access v.Range v.Type
- let env = if v.IsConstructor && not v.IsIncrClassConstructor then { env with ctorLimitedZone=true } else env
-
if cenv.reportErrors then
// Check top-level let-bound values
@@ -2643,7 +2633,6 @@ let CheckImplFile (g, amap, reportErrors, infoReader, internalsVisibleToPaths, v
let env =
{ sigToImplRemapInfo=[]
quote=false
- ctorLimitedZone=false
boundTyparNames=[]
argVals = ValMap.Empty
boundTypars= TyparMap.Empty
diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt
index 64f0876b61d..086d5279488 100644
--- a/src/Compiler/FSComp.txt
+++ b/src/Compiler/FSComp.txt
@@ -252,7 +252,7 @@ chkVariableUsedInInvalidWay,"The variable '%s' is used in an invalid way"
417,chkNoFirstClassRethrow,"First-class uses of the 'reraise' function is not permitted"
418,chkNoByrefAtThisPoint,"The byref typed value '%s' cannot be used at this point"
419,chkLimitationsOfBaseKeyword,"'base' values may only be used to make direct calls to the base implementations of overridden members"
-420,chkObjCtorsCantUseExceptionHandling,"Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL."
+#420,chkObjCtorsCantUseExceptionHandling,"Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL."
421,chkNoAddressOfAtThisPoint,"The address of the variable '%s' cannot be used at this point"
422,chkNoAddressStaticFieldAtThisPoint,"The address of the static field '%s' cannot be used at this point"
423,chkNoAddressFieldAtThisPoint,"The address of the field '%s' cannot be used at this point"
diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf
index 8a1853a380f..a9e1c015194 100644
--- a/src/Compiler/xlf/FSComp.txt.cs.xlf
+++ b/src/Compiler/xlf/FSComp.txt.cs.xlf
@@ -2257,11 +2257,6 @@
Hodnoty base se dají použít jenom k přímému volání implementací base přepsaných členů.
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Konstruktory objektu nemůžou použít try/with a try/finally přímo, dokud se objekt neinicializuje. To zahrnuje i konstrukce, jako je třeba for x in ..., které se dají na použití těchto konstruktorů rozpracovat. Toto je omezení mezijazyka Common IL.
-
- The address of the variable '{0}' cannot be used at this pointAdresa proměnné {0} se na tomto místě použít nedá.
diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf
index e96c8e1d3b2..98d3cec79d8 100644
--- a/src/Compiler/xlf/FSComp.txt.de.xlf
+++ b/src/Compiler/xlf/FSComp.txt.de.xlf
@@ -2257,11 +2257,6 @@
base-Werte dürfen nur für direkte Aufrufe der Basisimplementierungen von überschriebenen Membern verwendet werden.
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Objektkonstruktoren dürfen "try/with" und "try/finally" vor der Initialisierung des Objekts nicht direkt verwenden. Dies umfasst Konstrukte wie "for x in ...", bei denen diese Konstrukte u.U. verwendet werden. Dies ist eine Einschränkung der Common IL.
-
- The address of the variable '{0}' cannot be used at this pointDie Adresse der Variablen "{0}" kann an diesem Punkt nicht verwendet werden.
diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf
index 8c034062331..9ea5c76f74c 100644
--- a/src/Compiler/xlf/FSComp.txt.es.xlf
+++ b/src/Compiler/xlf/FSComp.txt.es.xlf
@@ -2257,11 +2257,6 @@
Los valores 'base' se pueden usar solo para realizar llamadas directas a las implementaciones base de miembros invalidados.
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Los constructores de objetos no pueden usar directamente try/with y try/finally antes de la inicialización del objeto. Esto incluye constructores como 'for x in ...' que pueden dar lugar a usos de estos constructores. Esta es una limitación impuesta por Common IL.
-
- The address of the variable '{0}' cannot be used at this pointLa dirección de la variable '{0}' no se puede usar en este punto.
diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf
index ab6345e8e0c..608877dac83 100644
--- a/src/Compiler/xlf/FSComp.txt.fr.xlf
+++ b/src/Compiler/xlf/FSComp.txt.fr.xlf
@@ -2257,11 +2257,6 @@
Les valeurs 'base' ne peuvent être utilisées que pour effectuer des appels directs aux implémentations de base des membres substitués
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Les constructeurs d'objets ne peuvent pas utiliser directement try/with et try/finally avant l'initialisation de l'objet. Cela inclut les constructions telles que 'for x in ...' qui peuvent conduire aux utilisations de ces constructions. Il s'agit d'une limitation imposée par le langage CIL (Common Intermediate Language).
-
- The address of the variable '{0}' cannot be used at this pointImpossible d'utiliser l'adresse de la variable '{0}' actuellement
diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf
index 85a4a4cd333..c616f13a22a 100644
--- a/src/Compiler/xlf/FSComp.txt.it.xlf
+++ b/src/Compiler/xlf/FSComp.txt.it.xlf
@@ -2257,11 +2257,6 @@
I valori 'base' possono essere utilizzati esclusivamente per effettuare chiamate dirette alle implementazioni di base dei membri sottoposti a override
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- I costruttori di oggetti non possono utilizzare direttamente try/with e try/finally prima dell'inizializzazione dell'oggetto. Ciò include costrutti quali 'for x in ...' che potrebbero essere elaborati negli utilizzi di tali costrutti. Si tratta di una limitazione imposta dall'IL comune.
-
- The address of the variable '{0}' cannot be used at this pointNon è possibile usare l'indirizzo della variabile '{0}' in questo punto
diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf
index 1a49a44350e..18b818fea07 100644
--- a/src/Compiler/xlf/FSComp.txt.ja.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ja.xlf
@@ -2257,11 +2257,6 @@
'base' 値を使用できるのは、オーバーライドされたメンバーの基本実装に対して直接呼び出しを行う場合のみです。
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- オブジェクト コンストラクターでは、オブジェクトの初期化前に try/with および try/finally を直接使用できません。'for x in ...' などのコストラクトを呼び出す可能性があるようなコンストラクトがこれに含まれます。これは Common IL での制限事項です。
-
- The address of the variable '{0}' cannot be used at this pointこの時点で変数 '{0}' のアドレスは使用できません
diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf
index 1a4cb6964d8..b361fa40679 100644
--- a/src/Compiler/xlf/FSComp.txt.ko.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ko.xlf
@@ -2257,11 +2257,6 @@
'base' 값은 재정의된 멤버의 기본 구현에 대한 직접 호출을 수행하는 데에만 사용할 수 있습니다.
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- 개체 생성자는 개체 초기화 전에 try/with 및 try/finally를 직접 사용할 수 없습니다. 여기에는 이러한 구문의 사용을 자세히 설명할 수 있는 'for x in ...'과 같은 구문이 포함됩니다. 이는 공통 IL의 제한입니다.
-
- The address of the variable '{0}' cannot be used at this point'{0}' 변수의 주소를 현재 사용할 수 없습니다.
diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf
index 1cc8dfb88f1..e746b8f8732 100644
--- a/src/Compiler/xlf/FSComp.txt.pl.xlf
+++ b/src/Compiler/xlf/FSComp.txt.pl.xlf
@@ -2257,11 +2257,6 @@
Wartości „base” mogą być używane tylko w celu bezpośrednich wywołań, które dotyczą podstawowych implementacji przesłoniętych elementów członkowskich
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Konstruktory obiektów nie mogą bezpośrednio używać instrukcji try/with i try/finally przed zainicjowaniem obiektu. Obejmuje to takie konstrukcje, jak „for x in ...”, które mogą skutkować użyciem takich konstrukcji. Jest to ograniczenie nałożone przez język Common IL.
-
- The address of the variable '{0}' cannot be used at this pointNie można użyć adresu zmiennej „{0}” w tym momencie
diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
index 1c898a6234e..00ab6117c7a 100644
--- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
+++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
@@ -2257,11 +2257,6 @@
Valores 'base' só podem ser usados para fazer chamadas diretas às implementações de base de membros substituídos
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Construtores de objeto não podem usar try/with nem try/finally antes da inicialização do objeto. O que inclui construções como ' x in... ' que podem elaborar usos dessas construções. Esta é uma limitação imposta pelo IL Comum.
-
- The address of the variable '{0}' cannot be used at this pointO endereço da variável '{0}' não pode ser usado neste ponto
diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf
index b9094d89e3f..8d68379843e 100644
--- a/src/Compiler/xlf/FSComp.txt.ru.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ru.xlf
@@ -2257,11 +2257,6 @@
Значения "base" можно использовать только для выполнения прямых вызовов реализаций класса base для переопределенных элементов
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- В конструкторе объекта нельзя прямо использовать блоки try/with и try/finally до инициализации объекта. К таким вариантам использования также относятся и конструкции вида "for x in ...", применение которых может привести к использованию указанных конструкций. Это ограничение связано с требованиями общего промежуточного языка.
-
- The address of the variable '{0}' cannot be used at this pointВ этой точке нельзя использовать адрес переменной "{0}"
diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf
index 7ee5a8cb3bc..25de80c1025 100644
--- a/src/Compiler/xlf/FSComp.txt.tr.xlf
+++ b/src/Compiler/xlf/FSComp.txt.tr.xlf
@@ -2257,11 +2257,6 @@
'base' değerleri yalnızca geçersiz kılınmış üyelerin taban uygulamalarına doğrudan çağrı yapmak için kullanılabilir
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- Nesne oluşturucular, nesnenin başlatılmasından önce try/with ve try/finally ifadelerini doğrudan kullanamazlar. Buna bu yapıların kullanımını çeşitlendirebilen 'for x in ...' gibi yapılar da dahildir. Bu, Ortak Ara Dilin getirdiği bir kısıtlamadır.
-
- The address of the variable '{0}' cannot be used at this point'{0}' değişkeninin adresi bu noktada kullanılamaz
diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
index 2659f03165a..ab75c3f45f0 100644
--- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
+++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
@@ -2257,11 +2257,6 @@
"base" 值只能用于直接调用重写成员的基实现
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- 在初始化对象之前,对象构造函数不能直接使用 try/with 和 try/finally。这包括像 "for x in ..." 这样详细说明其构造使用方式的构造。这是由通用 IL 设定的限制。
-
- The address of the variable '{0}' cannot be used at this point此时无法使用变量“{0}”的地址
diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
index f7f06f543fc..781002375e3 100644
--- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
+++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
@@ -2257,11 +2257,6 @@
'base' 值只能用來直接呼叫覆寫成員的基底實作
-
- Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL.
- 物件建構函式不能在物件初始化之前直接使用 try/with 和 try/finally。這包括 'for x in ...' 這類可以詳述這些建構用途的建構函式。這是 Common IL 的限制。
-
- The address of the variable '{0}' cannot be used at this point目前無法使用變數 '{0}' 的位址
diff --git a/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry01.fs b/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry01.fs
index d78d7ba06da..bebbbf4bbc5 100644
--- a/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry01.fs
+++ b/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry01.fs
@@ -1,6 +1,6 @@
// #Regression #Diagnostics
// Regression test for FSHARP1.0:1980
-//Object constructors cannot directly use try/with and try/finally prior to the initialization of the object\. This includes constructs such as 'for x in \.\.\.' that may elaborate to uses of these constructs\. This is a limitation imposed by Common IL\.$
+//
#light
type X = class
diff --git a/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry02.fs b/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry02.fs
index 1baff095c07..b1510fbf1a6 100644
--- a/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry02.fs
+++ b/tests/fsharpqa/Source/Diagnostics/General/E_ObjectConstructorAndTry02.fs
@@ -1,6 +1,6 @@
// #Regression #Diagnostics
// Regression test for FSHARP1.0:1980
-//Object constructors cannot directly use try/with and try/finally prior to the initialization of the object\. This includes constructs such as 'for x in \.\.\.' that may elaborate to uses of these constructs\. This is a limitation imposed by Common IL\.$
+//
#light
type X = struct