Skip to content

Commit

Permalink
Fix for dotnet#276:
Browse files Browse the repository at this point in the history
Combining struct field with units of measure will result managed type instead of unmanaged type

(Regression test to follow)
  • Loading branch information
andrewjkennedy committed Mar 2, 2015
1 parent e644ddd commit 4d194c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/fsharp/csolve.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,8 +1740,7 @@ and SolveTypIsUnmanaged (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
if isTyparTy g ty then
AddConstraint csenv ndeep m2 trace (destTyparTy g ty) (TyparConstraint.IsUnmanaged(m))
else
let underlyingTy = stripTyEqnsAndMeasureEqns g ty
if isUnmanagedTy g underlyingTy then
if isUnmanagedTy g ty then
CompleteD
else
ErrorD (ConstraintSolverError(FSComp.SR.csGenericConstructRequiresUnmanagedType(NicePrint.minimalStringOfType denv ty),m,m2))
Expand Down
1 change: 1 addition & 0 deletions src/fsharp/tastops.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@ let isStructTy g ty =
// - Any non-generic user-defined struct-type that contains fields of unmanaged-types only.
// [Note: Constructed types and type-parameters are never unmanaged-types. end note]
let rec isUnmanagedTy g ty =
let ty = stripTyEqnsAndMeasureEqns g ty
if isAppTy g ty then
let tcref = tcrefOfAppTy g ty
let isEq tcref2 = tyconRefEq g tcref tcref2
Expand Down

0 comments on commit 4d194c4

Please sign in to comment.