Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@cgranade
Copy link
Contributor

@cgranade cgranade commented Mar 4, 2021

This PR fixes #885 by updating the Visual Studio LSP client to the latest version. As that version enables nullable reference types, this PR also makes the needed changes to adapt to nullability metadata in that client.

@cgranade cgranade requested review from bamarsha and bettinaheim March 4, 2021 01:29
@cgranade cgranade changed the title Cgranade/fix 885 Fix #885 Mar 4, 2021
@ricardo-espinoza ricardo-espinoza self-requested a review March 12, 2021 16:41
@ricardo-espinoza ricardo-espinoza merged commit 3ffd626 into main Mar 12, 2021
ricardo-espinoza added a commit that referenced this pull request Mar 12, 2021
* [WIP] Started updating VS LSP client.
* A few more nullability fixes.
* Use explicit 0:0 range instead of relying on constructor.
* Propagate nullability metadata to F# callers.
* Avoid calling unsafe constructors.
* Avoid deprecated Assert.Equals.
* Set DocumentRangeFormattingProvider to false.
* Fix to AssertCapability.
* Assertions should work more reliabily when capabilities are null.
* Disable nullable reference checking when copying unsound types.
* Check if Range is null, since nullability metadata can be violated.

Co-authored-by: Ricardo Espinoza <ricardoe@microsoft.com>
bamarsha pushed a commit that referenced this pull request Mar 17, 2021
This reverts commit 3ffd626.
bamarsha pushed a commit that referenced this pull request Mar 31, 2021
This reverts commit a665fdd.
bamarsha added a commit that referenced this pull request Apr 22, 2021
* Fix test

* Update keyword comment

* Update doc comment

* Add doc comments

* Use expectedExpr

* Create fresh type parameter for empty arrays

* Use new type inference for concatenation

* Clean up Unify

* Add basic subtyping and constraint support to inference

* Remove duplicate type

* Add Iterates constraint

* Flip iterable and item types, add Satisfy method

* Remove unneeded functions

* Don't error in Unify if types equal

* Use correct subtyping relation in substitutions

* Treat addition and concatenation identically (semigroup)

* Add Equatable and Numeric constraints

* Add tests for empty array error

* Add tests for zero/negative sizes

* Clean up TypeInference.fs

* Factor out constraint checker

* Add basic call expression inference

* Add occurs check

* Use invalid types for fallback case in buildCall

* Add unification failed diagnostic

* Ignore invalid types in unification

* Don't add trivial substitutions

* Fix invalid type unification again

* Replace several exceptions with diagnostics

* Unify in TypeMatchArgument

* Reduce nesting in CheckConstraint

* Simplify type merging and resolution

* Avoid double diagnostics in commonType

* Fix range in inference diagnostics

* Update diagnostic message

* Update apply-and-reassign test

* Ignore missing types in unification

* Use HM for arithmetic ops

* Use HM for integral ops

* Fix remaining copy-and-update array tests

* Use HM for conditional expressions

* Resolve tvars in VerifyAssignment error message

* Use HM for symbol bindings and unwrap

* Add Indexed constraint

* Add back some operation call verification

* Fix variance in call expr arg tuple

* Fix variance in callable type unification

* Resolve type in buildNamedItem

* Resolve type in Constrain

* Resolve LHS in copy and update expression

* Update open-ended range tests

* Add partial application inference

* Resolve type in buildCall

* Add error for ambiguous type variables

* Fix common base type in arrays

* Update VerifyIsInteger

* Unified tuples should have the same length

* Remove type param recursion checks

* Create fresh tvars for all polymorphic identifiers, not just calls

* Add callable constraints

* Fix duplicate error message

* Update access modifier test

* Generate diagnostic for invalid equality

* Finalize HM types before capability diagnostics

* Fix type args on identifiers

* Fix inferred info for call exprs

* Update VerifyIsBoolean

* Update "Local namespace short names" test

* Fix order of tuple binding

* Update "Apply-and-reassign" test

* Update "argument matching" test

* Unify array types as invariant

* Update "Common base type" test

* Fix common base type

* Update type checking tests

* Update variance tests

* Update tests

* Fix partial application

* Add Adjointable and Controllable constraints

* Update "operation characteristics" test

* Remove commented out code

* Update tests

* Formatting

* Fix match warning

* Enable "Concrete Graph Double Reference Resolution" test

* Replace Variance with TypeOrdering

* Add TypeRelation type

* Remove TypeBound

* Apply constraints as soon as params are bound

* Use property

* Remove unnecessary pipes

* Rename things

* Simplify internal type inference API

* Clean up imports

* Remove Relation

* Rename AppliesPartial to HasPartialApplication

* Replace Set with HashSet

* Rewrite CommonBaseType

* Finish cleaning up Inference module

* Fix IsFresh

* Use one dictionary

* Clean up InferenceContext members

* Use consistent expected/actual order in UnifyByOrdering

* Use ResolvedTypes in InferenceContext.Resolve

* Clean up UnifyByOrdering

* Clean up fresh variable naming

* Update tests

* Remove IsFresh

* Remove some unnecessary code

* Clean up ExpressionVerification, remove diagnose callbacks

* Shorter name for inference context

* Add takeDiagnostics function

* More clean up

* Use TypedExpression instead of type * range tuples

* Clean up StatementVerification

* Simplify verifyExpr/verifyExprWith

* Correct range for ambiguous type diagnostics

* Remove ConstraintNotSatisfied and AmbiguousTypeVariable

* Add general type mismatch error codes

* Update tests

* Add range to ResolvedType

* Remove confusing ambiguous type diagnostics

* Remove ambiguous type error for unknown identifiers

* Clean up

* Fix empty array type

* Fix diagnostic range in use/borrow statement

* Generate InvalidArrayItemIndex diagnostic correctly

* Update type checking tests

* Update range info for local variable types

* Compare type params and UDTs without ranges

* Improved message for type mismatch diagnostic

* Fix some diagnostic bugs

* Use TypeContext with combine

* Improve common base type diagnostic

* Fix attaching type args to identifier

* Fix array slicing

* Revert "Fix #885 (#886)"

This reverts commit 3ffd626.

* Add integral constraint tests

* Add iterable constraint tests

* Update occurs check

* Add numeric constraint tests

* Add semigroup constraint tests

* Fix range of combined types

* Add wrapped constraint tests

* Improve missing base type diagnostic

* Remove unneeded type annotations

* Improve diagnostic range in array literal

* Formatting

* Remove type parameter warnings

* Formatting

* Update tests

* Add doc comments

* Add TypeInference folder

* Add signature files

* Rename member

* Update ResolvedType API and doc comments

* Add Hindley-Milner type inference module

* Update CompiledName for withAllRanges

* Add README

* Add result variable

* Fix README typos

* Add leading zeroes to error code

* Simplify check in bind

* Simplify check in bind

* Distinguish between annotated and inferred type ranges

* TP and UDT ranges are obsolete

* Visit range before type kind

* Formatting

* Distinguish between annotated and inferred type ranges

* TP and UDT ranges are obsolete

* Visit range before type kind

* Fix obsolete warnings

* Return Generated range from Intersect

* Return Generated range from Intersect

* Add CompiledNames

* Add CompiledNames

* Remove withSpanningRange

* Clarify subtyping in doc comments

* Update uses of obsolete range property

* Add TypeTransformationBase.OnTypeRange

* Add TODO for removing OnRangeInformation

* Ignore TP and UDT ranges in Bond serializer

* Ignore TP and UDT ranges in Bond deserializer

* Revert "Revert "Fix #885 (#886)""

This reverts commit a665fdd.

* Revert unnecessary changes

* Use HM inference in expression and statement verification

* Update comments

* Deprecate diagnostics

* Update doc comments in ExpressionVerification.fs

* Update LocalVerification.qs

* Refactor commaSep parsers

* Update unused type param warning

* Add TODOs for removing diagnostics

* Fix type param name in diagnostic

* Use OperationCallOutsideOfOperation diagnostic

* Use OperationCallOutsideOfOperation diagnostic

* Deprecate MissingExprInArray diagnostic

* Remove replaceTypeParams

* Remove VerifyNumberedItemAccess

* Rename VerifyArrayItem

* Add doc comment to partialArgType

* Update naming convention

* Nicer exprWithoutTypeArgs

* Clean up exprWithoutTypeArgs again

* Rename verifyConcatenation

* Update verifyUdtWith documentation

* Add range field to QsDeclarationAttribute

* Update SearchAndReplace.cs

* Support sized array in attribute arguments

* Make new record constructors non-extension methods

* Update unused type param message

* Handle SizedArray in code output and optimizations

* constructArray doesn't need to be rec

* Update StripPositionInfoFromType for TypeRange

* Improve ambiguous type error message

* Remove redundant showFunctor

* Better type mismatch error messages

* Restore alignment in error messages

* Add some type parameter inference tests

* Fix UDT constructors

* Rename MissingBaseType to TypeIntersectionMismatch
@ricardo-espinoza ricardo-espinoza deleted the cgranade/fix-885 branch February 3, 2022 02:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Q# Language Server fails to initialize in Visual Studio due to JsonReaderException

3 participants