Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89120a9

Browse files
committed
tryDestAppTy
1 parentd9348d6 commit89120a9

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,26 +1832,24 @@ and SolveTypRequiresDefaultConstructor (csenv:ConstraintSolverEnv) ndeep m2 trac
18321832
| None->
18331833
if isStructTy g ty&& TypeHasDefaultValue g m tythen
18341834
CompleteD
1835-
elif
1836-
GetIntrinsicConstructorInfosOfType csenv.InfoReader m ty
1837-
|> List.exists(fun x-> IsMethInfoAccessible amap m AccessibleFromEverywhere x&& x.IsNullary)
1838-
then
1839-
match tryDestAppTy g tywith
1840-
| Some tcrefwhen HasFSharpAttribute g g.attrib_AbstractClassAttribute tcref.Attribs->
1841-
ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresNonAbstract(NicePrint.minimalStringOfType denv typ),m,m2))
1842-
|_->
1843-
CompleteD
1844-
elif isAppTy g ty&&
1845-
(
1846-
lettcref= tcrefOfAppTy g ty
1847-
tcref.PreEstablishedHasDefaultConstructor||
1848-
// F# 3.1 feature: records with CLIMutable attribute should satisfy 'default constructor' constraint
1849-
(tcref.IsRecordTycon&& HasFSharpAttribute g g.attrib_CLIMutableAttribute tcref.Attribs)
1850-
)
1851-
then
1852-
CompleteD
1853-
else
1854-
ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresPublicDefaultConstructor(NicePrint.minimalStringOfType denv typ),m,m2))
1835+
else
1836+
if GetIntrinsicConstructorInfosOfType csenv.InfoReader m ty
1837+
|> List.exists(fun x-> IsMethInfoAccessible amap m AccessibleFromEverywhere x&& x.IsNullary)
1838+
then
1839+
match tryDestAppTy g tywith
1840+
| Some tcrefwhen HasFSharpAttribute g g.attrib_AbstractClassAttribute tcref.Attribs->
1841+
ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresNonAbstract(NicePrint.minimalStringOfType denv typ),m,m2))
1842+
|_->
1843+
CompleteD
1844+
else
1845+
match tryDestAppTy g tywith
1846+
| Some tcrefwhen
1847+
tcref.PreEstablishedHasDefaultConstructor||
1848+
// F# 3.1 feature: records with CLIMutable attribute should satisfy 'default constructor' constraint
1849+
(tcref.IsRecordTycon&& HasFSharpAttribute g g.attrib_CLIMutableAttribute tcref.Attribs)->
1850+
CompleteD
1851+
|_->
1852+
ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresPublicDefaultConstructor(NicePrint.minimalStringOfType denv typ),m,m2))
18551853

18561854
// Parameterized compatibility relation between member signatures. The real work
18571855
// is done by "equateTypes" and "subsumeTypes" and "subsumeArg"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp