Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/QsCompiler/DataStructures/Diagnostics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ type WarningCode =
| [<Obsolete("This diagnostic is no longer in use. The error InvalidUseOfUnderscorePattern is given instead.")>] UseOfUnderscorePattern = 3305
| DeprecatedTupleBrackets = 3306
| DeprecatedQubitBindingKeyword = 3307
| DeprecatedNewArray = 3308
| DeprecatedRUSloopInFunction = 4001

| DiscardingItemInAssignment = 5001
Expand Down Expand Up @@ -954,6 +955,8 @@ type DiagnosticItem =
| WarningCode.DeprecatedQubitBindingKeyword ->
"The \"{0}\" keyword has been replaced with \"{1}\", and qubits may now be allocated without a block. "
+ "Consider \"{1} q = Qubit();\" or \"{1} q = Qubit() {{ ... }}\"."
| WarningCode.DeprecatedNewArray ->
"Deprecated syntax. Use [] to construct an empty array, or [x, size = n] to construct an array of x repeated n times."
| WarningCode.DeprecatedRUSloopInFunction ->
"The use of repeat-until-success-loops within functions may not be supported in the future. Please use a while-loop instead."

Expand Down
8 changes: 6 additions & 2 deletions src/QsCompiler/Tests.Compiler/AccessModifierTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ type AccessModifierTests() =

[<Fact>]
member this.Types() =
this.Expect "TypeUseOK" []
this.Expect "TypeReferenceInternalInaccessible" [ Error ErrorCode.InaccessibleType ]
this.Expect "TypeUseOK" (Warning WarningCode.DeprecatedNewArray |> List.replicate 3)

this.Expect
"TypeReferenceInternalInaccessible"
[ Error ErrorCode.InaccessibleType; Warning WarningCode.DeprecatedNewArray ]

this.Expect "TypeConstructorReferenceInternalInaccessible" [ Error ErrorCode.InaccessibleCallable ]

[<Fact>]
Expand Down
17 changes: 12 additions & 5 deletions src/QsCompiler/Tests.Compiler/GlobalVerificationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ type GlobalVerificationTests() =
this.Expect "LocalNamespaceShortNames1" []
this.Expect "LocalNamespaceShortNames2" []
this.Expect "LocalNamespaceShortNames3" [ Error ErrorCode.UnknownType ]
this.Expect "LocalNamespaceShortNames4" [ Error ErrorCode.UnknownType ]
this.Expect "LocalNamespaceShortNames4" [ Error ErrorCode.UnknownType; Warning WarningCode.DeprecatedNewArray ]
this.Expect "LocalNamespaceShortNames5" [ Error ErrorCode.UnknownIdentifier ]
this.Expect "LocalNamespaceShortNames6" [ Error ErrorCode.TypeMismatch; Error ErrorCode.TypeMismatch ]
this.Expect "LocalNamespaceShortNames7" [ Error ErrorCode.UnknownIdentifier ]
this.Expect "LocalNamespaceShortNames8" []
this.Expect "LocalNamespaceShortNames9" []
this.Expect "LocalNamespaceShortNames9" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "LocalNamespaceShortNames10" []
this.Expect "LocalNamespaceShortNames11" [ Error ErrorCode.UnknownType; Error ErrorCode.UnknownIdentifier ]
this.Expect "LocalNamespaceShortNames12" [ Error ErrorCode.UnknownIdentifier ]
Expand All @@ -53,7 +53,7 @@ type GlobalVerificationTests() =
this.Expect "LocalNamespaceShortNames19" []
this.Expect "LocalNamespaceShortNames20" []
this.Expect "LocalNamespaceShortNames21" []
this.Expect "LocalNamespaceShortNames22" []
this.Expect "LocalNamespaceShortNames22" (Warning WarningCode.DeprecatedNewArray |> List.replicate 2)
this.Expect "LocalNamespaceShortNames23" []
this.Expect "LocalNamespaceShortNames24" []

Expand Down Expand Up @@ -533,7 +533,7 @@ type GlobalVerificationTests() =
this.Expect "ValidAttributes1" []
this.Expect "ValidAttributes2" []
this.Expect "ValidAttributes3" []
this.Expect "ValidAttributes4" []
this.Expect "ValidAttributes4" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "ValidAttributes5" []
this.Expect "ValidAttributes6" []
this.Expect "ValidAttributes7" []
Expand All @@ -555,7 +555,14 @@ type GlobalVerificationTests() =
this.Expect "InvalidAttributes5" [ Error ErrorCode.UnknownTypeInNamespace ]
this.Expect "InvalidAttributes6" [ Error ErrorCode.AttributeArgumentTypeMismatch ]
this.Expect "InvalidAttributes7" [ Error ErrorCode.InvalidAttributeArgument ]
this.Expect "InvalidAttributes8" [ Error ErrorCode.ArgumentOfUserDefinedTypeInAttribute ]

this.Expect
"InvalidAttributes8"
[
Error ErrorCode.ArgumentOfUserDefinedTypeInAttribute
Warning WarningCode.DeprecatedNewArray
]

this.Expect "InvalidAttributes9" [ Error ErrorCode.MisplacedDeclarationAttribute ]
this.Expect "InvalidAttributes10" [ Error ErrorCode.MisplacedDeclarationAttribute ]
this.Expect "InvalidAttributes11" [ Error ErrorCode.MisplacedDeclarationAttribute ]
Expand Down
81 changes: 56 additions & 25 deletions src/QsCompiler/Tests.Compiler/LocalVerificationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ type LocalVerificationTests() =

this.Expect "TypeArgumentsInference6" []
this.Expect "TypeArgumentsInference7" []
this.Expect "TypeArgumentsInference8" []
this.Expect "TypeArgumentsInference9" []
this.Expect "TypeArgumentsInference8" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference9" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference10" []
this.Expect "TypeArgumentsInference11" []
this.Expect "TypeArgumentsInference12" []
this.Expect "TypeArgumentsInference13" []
this.Expect "TypeArgumentsInference14" []
this.Expect "TypeArgumentsInference15" []
this.Expect "TypeArgumentsInference16" []
this.Expect "TypeArgumentsInference17" []
this.Expect "TypeArgumentsInference18" []
this.Expect "TypeArgumentsInference16" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference17" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference18" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference19" []
this.Expect "TypeArgumentsInference20" []
this.Expect "TypeArgumentsInference21" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference22" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference23" []
this.Expect "TypeArgumentsInference24" []
this.Expect "TypeArgumentsInference25" []
this.Expect "TypeArgumentsInference26" []
this.Expect "TypeArgumentsInference25" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference26" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference27" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference28" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference29" [ Error ErrorCode.InvalidCyclicTypeParameterResolution ]
Expand All @@ -88,8 +88,8 @@ type LocalVerificationTests() =
this.Expect "TypeArgumentsInference33" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference34" []
this.Expect "TypeArgumentsInference35" []
this.Expect "TypeArgumentsInference36" []
this.Expect "TypeArgumentsInference37" []
this.Expect "TypeArgumentsInference36" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference37" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "TypeArgumentsInference38" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference39" [ Error ErrorCode.TypeMismatch ]
this.Expect "TypeArgumentsInference40" []
Expand Down Expand Up @@ -134,10 +134,10 @@ type LocalVerificationTests() =

this.Expect "VariableDeclaration15" []
this.Expect "VariableDeclaration16" []
this.Expect "VariableDeclaration17" []
this.Expect "VariableDeclaration18" []
this.Expect "VariableDeclaration19" []
this.Expect "VariableDeclaration20" []
this.Expect "VariableDeclaration17" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "VariableDeclaration18" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "VariableDeclaration19" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "VariableDeclaration20" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "VariableDeclaration21" []
this.Expect "VariableDeclaration22" []
this.Expect "VariableDeclaration23" []
Expand All @@ -157,7 +157,7 @@ type LocalVerificationTests() =
this.Expect "CopyAndUpdateArray1" []
this.Expect "CopyAndUpdateArray2" []
this.Expect "CopyAndUpdateArray3" []
this.Expect "CopyAndUpdateArray4" []
this.Expect "CopyAndUpdateArray4" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "CopyAndUpdateArray5" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "CopyAndUpdateArray6" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "CopyAndUpdateArray7" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
Expand All @@ -179,11 +179,23 @@ type LocalVerificationTests() =
this.Expect "UpdateAndReassign3" []
this.Expect "UpdateAndReassign4" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "UpdateAndReassign5" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "UpdateAndReassign6" []
this.Expect "UpdateAndReassign7" []
this.Expect "UpdateAndReassign8" []
this.Expect "UpdateAndReassign9" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "UpdateAndReassign10" [ Error ErrorCode.TypeMismatchInCopyAndUpdateExpr ]
this.Expect "UpdateAndReassign6" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "UpdateAndReassign7" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "UpdateAndReassign8" [ Warning WarningCode.DeprecatedNewArray ]

this.Expect
"UpdateAndReassign9"
[
Error ErrorCode.TypeMismatchInCopyAndUpdateExpr
Warning WarningCode.DeprecatedNewArray
]

this.Expect
"UpdateAndReassign10"
[
Error ErrorCode.TypeMismatchInCopyAndUpdateExpr
Warning WarningCode.DeprecatedNewArray
]


[<Fact>]
Expand Down Expand Up @@ -234,7 +246,7 @@ type LocalVerificationTests() =
this.Expect "ItemAccess16" []
this.Expect "ItemAccess17" []
this.Expect "ItemAccess18" []
this.Expect "ItemAccess19" []
this.Expect "ItemAccess19" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "ItemAccess20" []


Expand All @@ -255,22 +267,29 @@ type LocalVerificationTests() =
Error ErrorCode.TypeMismatchInCopyAndUpdateExpr
]

this.Expect "ItemUpdate9" []
this.Expect "ItemUpdate9" [ Warning WarningCode.DeprecatedNewArray ]

this.Expect
"ItemUpdate10"
[
Error ErrorCode.InvalidIdentifierExprInUpdate
Error ErrorCode.ExcessContinuation
Warning WarningCode.DeprecatedNewArray
]

this.Expect "ItemUpdate11" [ Error ErrorCode.UpdateOfArrayItemExpr ]
this.Expect
"ItemUpdate11"
[
Error ErrorCode.UpdateOfArrayItemExpr
Warning WarningCode.DeprecatedNewArray
]

this.Expect
"ItemUpdate12"
[
Error ErrorCode.TypeMismatchInCopyAndUpdateExpr
Error ErrorCode.TypeMismatchInCopyAndUpdateExpr
Warning WarningCode.DeprecatedNewArray
]

this.Expect "ItemUpdate13" []
Expand All @@ -294,7 +313,7 @@ type LocalVerificationTests() =
this.Expect "ItemUpdate18" [ Error ErrorCode.MissingFunctorForAutoGeneration ]
this.Expect "ItemUpdate19" [ Error ErrorCode.MissingFunctorForAutoGeneration ]
this.Expect "ItemUpdate20" []
this.Expect "ItemUpdate21" []
this.Expect "ItemUpdate21" [ Warning WarningCode.DeprecatedNewArray ]
this.Expect "ItemUpdate22" []


Expand Down Expand Up @@ -374,7 +393,13 @@ type LocalVerificationTests() =
this.Expect "UsingDepAttrInDepCall" [ Warning WarningCode.DeprecationWithoutRedirect ]
this.Expect "UsingDepTypeInDepCall" [ Warning WarningCode.DeprecationWithoutRedirect ]

this.Expect "UsingDeprecatedType1" [ Warning WarningCode.DeprecationWithoutRedirect ]
this.Expect
"UsingDeprecatedType1"
[
Warning WarningCode.DeprecationWithoutRedirect
Warning WarningCode.DeprecatedNewArray
]

this.Expect "UsingDeprecatedType2" [ Warning WarningCode.DeprecationWithoutRedirect ]
this.Expect "UsingDeprecatedType3" [ Warning WarningCode.DeprecationWithoutRedirect ]

Expand All @@ -392,7 +417,13 @@ type LocalVerificationTests() =
Warning WarningCode.DeprecationWithoutRedirect
]

this.Expect "UsingRenamedType1" [ Warning WarningCode.DeprecationWithRedirect ]
this.Expect
"UsingRenamedType1"
[
Warning WarningCode.DeprecationWithRedirect
Warning WarningCode.DeprecatedNewArray
]

this.Expect "UsingRenamedType2" [ Warning WarningCode.DeprecationWithRedirect ]
this.Expect "UsingRenamedType3" [ Warning WarningCode.DeprecationWithRedirect ]

Expand Down
Loading