Skip to content

Commit 3a3b812

Browse files
authored
fix 13533 (#13950)
1 parent 342a6d2 commit 3a3b812

17 files changed

+4
-80
lines changed

src/Compiler/Checking/PostInferenceChecks.fs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ type env =
8585
/// "module remap info", i.e. hiding information down the signature chain, used to compute what's hidden by a signature
8686
sigToImplRemapInfo: (Remap * SignatureHidingInfo) list
8787

88-
/// Constructor limited - are we in the prelude of a constructor, prior to object initialization
89-
ctorLimitedZone: bool
90-
9188
/// Are we in a quotation?
9289
quote : bool
9390

@@ -1143,7 +1140,7 @@ and CheckExpr (cenv: cenv) (env: env) origExpr (ctxt: PermitByRefExpr) : Limit =
11431140

11441141
| Expr.Sequential (e1, e2, ThenDoSeq, _) ->
11451142
CheckExprNoByrefs cenv env e1
1146-
CheckExprNoByrefs cenv {env with ctorLimitedZone=false} e2
1143+
CheckExprNoByrefs cenv env e2
11471144
NoLimit
11481145

11491146
| Expr.Const (_, m, ty) ->
@@ -1425,9 +1422,6 @@ and CheckNoResumableStmtConstructs cenv _env expr =
14251422
and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
14261423
let g = cenv.g
14271424

1428-
let ctorLimitedZoneCheck() =
1429-
if env.ctorLimitedZone then errorR(Error(FSComp.SR.chkObjCtorsCantUseExceptionHandling(), m))
1430-
14311425
// Ensure anonymous record type requirements are recorded
14321426
match op with
14331427
| TOp.AnonRecdGet (anonInfo, _)
@@ -1444,7 +1438,6 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
14441438

14451439
| TOp.TryFinally _, [_], [Expr.Lambda (_, _, _, [_], e1, _, _); Expr.Lambda (_, _, _, [_], e2, _, _)] ->
14461440
CheckTypeInstNoInnerByrefs cenv env m tyargs // result of a try/finally can be a byref
1447-
ctorLimitedZoneCheck()
14481441
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
14491442
CheckExprNoByrefs cenv env e2
14501443
limit
@@ -1455,7 +1448,6 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
14551448

14561449
| TOp.TryWith _, [_], [Expr.Lambda (_, _, _, [_], e1, _, _); Expr.Lambda (_, _, _, [_], _e2, _, _); Expr.Lambda (_, _, _, [_], e3, _, _)] ->
14571450
CheckTypeInstNoInnerByrefs cenv env m tyargs // result of a try/catch can be a byref
1458-
ctorLimitedZoneCheck()
14591451
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
14601452
// [(* e2; -- don't check filter body - duplicates logic in 'catch' body *) e3]
14611453
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
20102002
let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.DeclaringEntity.CompilationPath) v.Accessibility
20112003
CheckTypeForAccess cenv env (fun () -> NicePrint.stringOfQualifiedValOrMember cenv.denv cenv.infoReader vref) access v.Range v.Type
20122004

2013-
let env = if v.IsConstructor && not v.IsIncrClassConstructor then { env with ctorLimitedZone=true } else env
2014-
20152005
if cenv.reportErrors then
20162006

20172007
// Check top-level let-bound values
@@ -2643,7 +2633,6 @@ let CheckImplFile (g, amap, reportErrors, infoReader, internalsVisibleToPaths, v
26432633
let env =
26442634
{ sigToImplRemapInfo=[]
26452635
quote=false
2646-
ctorLimitedZone=false
26472636
boundTyparNames=[]
26482637
argVals = ValMap.Empty
26492638
boundTypars= TyparMap.Empty

src/Compiler/FSComp.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ chkVariableUsedInInvalidWay,"The variable '%s' is used in an invalid way"
252252
417,chkNoFirstClassRethrow,"First-class uses of the 'reraise' function is not permitted"
253253
418,chkNoByrefAtThisPoint,"The byref typed value '%s' cannot be used at this point"
254254
419,chkLimitationsOfBaseKeyword,"'base' values may only be used to make direct calls to the base implementations of overridden members"
255-
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."
255+
#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."
256256
421,chkNoAddressOfAtThisPoint,"The address of the variable '%s' cannot be used at this point"
257257
422,chkNoAddressStaticFieldAtThisPoint,"The address of the static field '%s' cannot be used at this point"
258258
423,chkNoAddressFieldAtThisPoint,"The address of the field '%s' cannot be used at this point"

src/Compiler/xlf/FSComp.txt.cs.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">Hodnoty base se dají použít jenom k přímému volání implementací base přepsaných členů.</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">Adresa proměnné {0} se na tomto místě použít nedá.</target>

src/Compiler/xlf/FSComp.txt.de.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">base-Werte dürfen nur für direkte Aufrufe der Basisimplementierungen von überschriebenen Membern verwendet werden.</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">Die Adresse der Variablen "{0}" kann an diesem Punkt nicht verwendet werden.</target>

src/Compiler/xlf/FSComp.txt.es.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">Los valores 'base' se pueden usar solo para realizar llamadas directas a las implementaciones base de miembros invalidados.</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">La dirección de la variable '{0}' no se puede usar en este punto.</target>

src/Compiler/xlf/FSComp.txt.fr.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">Les valeurs 'base' ne peuvent être utilisées que pour effectuer des appels directs aux implémentations de base des membres substitués</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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).</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">Impossible d'utiliser l'adresse de la variable '{0}' actuellement</target>

src/Compiler/xlf/FSComp.txt.it.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">I valori 'base' possono essere utilizzati esclusivamente per effettuare chiamate dirette alle implementazioni di base dei membri sottoposti a override</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">Non è possibile usare l'indirizzo della variabile '{0}' in questo punto</target>

src/Compiler/xlf/FSComp.txt.ja.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">'base' 値を使用できるのは、オーバーライドされたメンバーの基本実装に対して直接呼び出しを行う場合のみです。</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">オブジェクト コンストラクターでは、オブジェクトの初期化前に try/with および try/finally を直接使用できません。'for x in ...' などのコストラクトを呼び出す可能性があるようなコンストラクトがこれに含まれます。これは Common IL での制限事項です。</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">この時点で変数 '{0}' のアドレスは使用できません</target>

src/Compiler/xlf/FSComp.txt.ko.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">'base' 값은 재정의된 멤버의 기본 구현에 대한 직접 호출을 수행하는 데에만 사용할 수 있습니다.</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">개체 생성자는 개체 초기화 전에 try/with 및 try/finally를 직접 사용할 수 없습니다. 여기에는 이러한 구문의 사용을 자세히 설명할 수 있는 'for x in ...'과 같은 구문이 포함됩니다. 이는 공통 IL의 제한입니다.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">'{0}' 변수의 주소를 현재 사용할 수 없습니다.</target>

src/Compiler/xlf/FSComp.txt.pl.xlf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,6 @@
22572257
<target state="translated">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</target>
22582258
<note />
22592259
</trans-unit>
2260-
<trans-unit id="chkObjCtorsCantUseExceptionHandling">
2261-
<source>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.</source>
2262-
<target state="translated">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.</target>
2263-
<note />
2264-
</trans-unit>
22652260
<trans-unit id="chkNoAddressOfAtThisPoint">
22662261
<source>The address of the variable '{0}' cannot be used at this point</source>
22672262
<target state="translated">Nie można użyć adresu zmiennej „{0}” w tym momencie</target>

0 commit comments

Comments
 (0)