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
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas-tool": {
"version": "4.3.0-alpha-001",
"version": "4.4.0",
"commands": [
"fantomas"
]
Expand Down
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ indent_size = 4

fsharp_max_array_or_list_width = 80
fsharp_max_dot_get_expression_width = 100
fsharp_max_if_then_else_short_width = 100
fsharp_max_infix_operator_expression = 100
fsharp_max_record_number_of_items = 2
fsharp_max_value_binding_width = 100
Expand Down
29 changes: 13 additions & 16 deletions src/QsCompiler/Core/ConstructorExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ type ResolvedSignature with
}

type QsSpecialization with
static member New kind
(source, location)
(parent, attributes, typeArgs, signature, implementation, documentation, comments)
=
static member New
kind
(source, location)
(parent, attributes, typeArgs, signature, implementation, documentation, comments)
=
{
Kind = kind
Parent = parent
Expand All @@ -192,17 +193,11 @@ type QsSpecialization with
static member NewControlledAdjoint = QsSpecialization.New QsControlledAdjoint

type QsCallable with
static member New kind
(source, location)
(name,
attributes,
access,
argTuple,
signature,
specializations: IEnumerable<_>,
documentation,
comments)
=
static member New
kind
(source, location)
(name, attributes, access, argTuple, signature, specializations: IEnumerable<_>, documentation, comments)
=
{
Kind = kind
FullName = name
Expand Down Expand Up @@ -251,7 +246,9 @@ type QsNamespaceElement with
static member NewOperation loc =
QsCallable.NewOperation loc >> QsCallable

static member NewFunction loc = QsCallable.NewFunction loc >> QsCallable
static member NewFunction loc =
QsCallable.NewFunction loc >> QsCallable

static member NewType loc = QsCustomType.New loc >> QsCustomType

type QsNamespace with
Expand Down
51 changes: 27 additions & 24 deletions src/QsCompiler/Core/DeclarationHeaders.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ module DeclarationHeader =
type private NullableOffsetConverter() =
inherit JsonConverter<Offset>()

override this.ReadJson(reader: JsonReader,
objectType: Type,
existingValue: Offset,
hasExistingValue: bool,
serializer: JsonSerializer) =
override this.ReadJson
(
reader: JsonReader,
objectType: Type,
existingValue: Offset,
hasExistingValue: bool,
serializer: JsonSerializer
) =
if reader.ValueType <> typeof<String> || (string) reader.Value <> "Undefined" then
let offset = serializer.Deserialize<Position>(reader)
if Object.ReferenceEquals(offset, null) then Offset.Undefined else Offset.Defined offset
Expand All @@ -68,11 +71,14 @@ module DeclarationHeader =
type private NullableRangeConverter() =
inherit JsonConverter<Range>()

override this.ReadJson(reader: JsonReader,
objectType: Type,
existingValue: Range,
hasExistingValue: bool,
serializer: JsonSerializer) =
override this.ReadJson
(
reader: JsonReader,
objectType: Type,
existingValue: Range,
hasExistingValue: bool,
serializer: JsonSerializer
) =
if reader.ValueType <> typeof<String> || (string) reader.Value <> "Undefined" then
let range = serializer.Deserialize<DataTypes.Range>(reader)
if Object.ReferenceEquals(range, null) then Range.Undefined else Range.Defined range
Expand Down Expand Up @@ -202,10 +208,7 @@ type TypeDeclarationHeader =
let header = TypeDeclarationHeader.OfSchema schema
let attributesAreNullOrDefault = Object.ReferenceEquals(header.Attributes, null) || header.Attributes.IsDefault

let header =
if attributesAreNullOrDefault
then { header with Attributes = ImmutableArray.Empty }
else header // no reason to raise an error
let header = if attributesAreNullOrDefault then { header with Attributes = ImmutableArray.Empty } else header // no reason to raise an error

if not (Object.ReferenceEquals(header.TypeItems, null)) then
success, header
Expand Down Expand Up @@ -336,15 +339,18 @@ type CallableDeclarationHeader =
let header = CallableDeclarationHeader.OfSchema schema
let attributesAreNullOrDefault = Object.ReferenceEquals(header.Attributes, null) || header.Attributes.IsDefault

let header =
if attributesAreNullOrDefault
then { header with Attributes = ImmutableArray.Empty }
else header // no reason to raise an error
let header = if attributesAreNullOrDefault then { header with Attributes = ImmutableArray.Empty } else header // no reason to raise an error

let header = { header with ArgumentTuple = header.ArgumentTuple |> setInferredInfo }

if Object.ReferenceEquals(header.Signature.Information, null)
|| Object.ReferenceEquals(header.Signature.Information.Characteristics, null) then
if
Object.ReferenceEquals(header.Signature.Information, null)
|| Object.ReferenceEquals
(
header.Signature.Information.Characteristics,
null
)
then
false, { header with Signature = { header.Signature with Information = CallableInformation.Invalid } }
else
success, header
Expand Down Expand Up @@ -457,10 +463,7 @@ type SpecializationDeclarationHeader =
let typeArgsAreNull = Object.ReferenceEquals(header.TypeArguments, null)
let attributesAreNullOrDefault = Object.ReferenceEquals(header.Attributes, null) || header.Attributes.IsDefault

let header =
if attributesAreNullOrDefault
then { header with Attributes = ImmutableArray.Empty }
else header // no reason to raise an error
let header = if attributesAreNullOrDefault then { header with Attributes = ImmutableArray.Empty } else header // no reason to raise an error

if not (infoIsNull || typeArgsAreNull) then
success, header
Expand Down
Loading