From 0c64995ea28febcc7d38e1519da8d93391ce2e7d Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 7 Jun 2022 14:10:49 -0700 Subject: Major language server features. (#2264) * Major language server features. * Include slangd in binary release. * Fix compiler issues. * Fix compiler error. * Completion resolve. * Various improvements. * Update diagnostic test expected output. * Bug fix for source locations. * Adjust diagnostic update frequency. * Update github actions to store artifacts. * Fix infinite parser loop. * Fix parser recovery. * Fix parser recovery. * Update test. * Fix test. * Disable IR gen for language server. * Allow commit characters in auto completion. * Fix lookup for invoke exprs. * More parser robustness fixes. * update solution file Co-authored-by: Yong He --- .../generic-type-arg-overloaded.slang.expected | 8 +-- tests/bugs/parser-infinite-loop.slang | 11 ++++ tests/bugs/parser-infinite-loop.slang.expected | 11 ++++ tests/diagnostics/bad-operator-call.slang.expected | 76 +++++++++++----------- .../anyvalue-size-validation.slang.expected | 2 +- tests/diagnostics/matrix-swizzle.slang.expected | 26 ++++---- tests/diagnostics/mismatching-types.slang.expected | 6 +- .../static-ref-to-nonstatic-member.slang.expected | 2 +- .../variable-redeclaration.slang.expected | 4 +- 9 files changed, 84 insertions(+), 62 deletions(-) create mode 100644 tests/bugs/parser-infinite-loop.slang create mode 100644 tests/bugs/parser-infinite-loop.slang.expected (limited to 'tests') diff --git a/tests/bugs/generic-type-arg-overloaded.slang.expected b/tests/bugs/generic-type-arg-overloaded.slang.expected index 126dcfa60..390c4fe00 100644 --- a/tests/bugs/generic-type-arg-overloaded.slang.expected +++ b/tests/bugs/generic-type-arg-overloaded.slang.expected @@ -2,16 +2,16 @@ result code = -1 standard error = { tests/bugs/generic-type-arg-overloaded.slang(14): error 30200: declaration of 'Stuff' conflicts with existing declaration struct Stuff {} -^~~~~~ + ^~~~~ tests/bugs/generic-type-arg-overloaded.slang(11): note: see previous declaration of 'Stuff' tests/bugs/generic-type-arg-overloaded.slang(26): error 39999: ambiguous reference to 'Stuff' return util() ^~~~~ -tests/bugs/generic-type-arg-overloaded.slang(14): note 39999: candidate: Stuff -tests/bugs/generic-type-arg-overloaded.slang(11): note 39999: candidate: Stuff +tests/bugs/generic-type-arg-overloaded.slang(14): note 39999: candidate: struct Stuff +tests/bugs/generic-type-arg-overloaded.slang(11): note 39999: candidate: struct Stuff tests/bugs/generic-type-arg-overloaded.slang(32): error 39999: expected a generic when using '<...>' (found: '() -> int') + nonGeneric(); - ^ + ^~~~~~~~~~ } standard output = { } diff --git a/tests/bugs/parser-infinite-loop.slang b/tests/bugs/parser-infinite-loop.slang new file mode 100644 index 000000000..70abc9260 --- /dev/null +++ b/tests/bugs/parser-infinite-loop.slang @@ -0,0 +1,11 @@ +//DIAGNOSTIC_TEST:SIMPLE: + +struct test +{ + float3 field; +} +void f() +{ + test x; x + vector v; +} diff --git a/tests/bugs/parser-infinite-loop.slang.expected b/tests/bugs/parser-infinite-loop.slang.expected new file mode 100644 index 000000000..df1d731bc --- /dev/null +++ b/tests/bugs/parser-infinite-loop.slang.expected @@ -0,0 +1,11 @@ +result code = -1 +standard error = { +tests/bugs/parser-infinite-loop.slang(10): error 20001: unexpected integer literal, expected identifier + vector v; + ^ +tests/bugs/parser-infinite-loop.slang(10): error 20001: unexpected identifier, expected '(' + vector v; + ^ +} +standard output = { +} diff --git a/tests/diagnostics/bad-operator-call.slang.expected b/tests/diagnostics/bad-operator-call.slang.expected index 6b8f250d3..e7dc23739 100644 --- a/tests/diagnostics/bad-operator-call.slang.expected +++ b/tests/diagnostics/bad-operator-call.slang.expected @@ -3,36 +3,36 @@ standard error = { tests/diagnostics/bad-operator-call.slang(18): error 39999: no overload for '+=' applicable to arguments of type (int, S) a += b; ^~ -core.meta.slang(1937): note 39999: candidate: func +=(out matrix, T) -> matrix -core.meta.slang(1929): note 39999: candidate: func +=(out matrix, matrix) -> matrix -core.meta.slang(1921): note 39999: candidate: func +=(out vector, T) -> vector -core.meta.slang(1913): note 39999: candidate: func +=(out vector, vector) -> vector -core.meta.slang(1905): note 39999: candidate: func +=(out T, T) -> T +core.meta.slang(1940): note 39999: candidate: __unsafeForceInlineEarly func +=(out matrix, T) -> matrix +core.meta.slang(1932): note 39999: candidate: __unsafeForceInlineEarly func +=(out matrix, matrix) -> matrix +core.meta.slang(1924): note 39999: candidate: __unsafeForceInlineEarly func +=(out vector, T) -> vector +core.meta.slang(1916): note 39999: candidate: __unsafeForceInlineEarly func +=(out vector, vector) -> vector +core.meta.slang(1908): note 39999: candidate: __unsafeForceInlineEarly func +=(out T, T) -> T tests/diagnostics/bad-operator-call.slang(20): error 39999: no overload for '+' applicable to arguments of type (int, S) a = a + b; ^ -core.meta.slang(1743): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(1736): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(1729): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t -core.meta.slang(1722): note 39999: candidate: func +(uint8_t, uint8_t) -> uint8_t -core.meta.slang(1715): note 39999: candidate: func +(double, double) -> double -core.meta.slang(1708): note 39999: candidate: func +(float, float) -> float -core.meta.slang(1701): note 39999: candidate: func +(half, half) -> half -core.meta.slang(1694): note 39999: candidate: func +(int64_t, int64_t) -> int64_t -core.meta.slang(1687): note 39999: candidate: func +(int, int) -> int -core.meta.slang(1680): note 39999: candidate: func +(int16_t, int16_t) -> int16_t +core.meta.slang(1746): note 39999: candidate: __intrinsic_op func +(uint64_t, uint64_t) -> uint64_t +core.meta.slang(1739): note 39999: candidate: __intrinsic_op func +(uint, uint) -> uint +core.meta.slang(1732): note 39999: candidate: __intrinsic_op func +(uint16_t, uint16_t) -> uint16_t +core.meta.slang(1725): note 39999: candidate: __intrinsic_op func +(uint8_t, uint8_t) -> uint8_t +core.meta.slang(1718): note 39999: candidate: __intrinsic_op func +(double, double) -> double +core.meta.slang(1711): note 39999: candidate: __intrinsic_op func +(float, float) -> float +core.meta.slang(1704): note 39999: candidate: __intrinsic_op func +(half, half) -> half +core.meta.slang(1697): note 39999: candidate: __intrinsic_op func +(int64_t, int64_t) -> int64_t +core.meta.slang(1690): note 39999: candidate: __intrinsic_op func +(int, int) -> int +core.meta.slang(1683): note 39999: candidate: __intrinsic_op func +(int16_t, int16_t) -> int16_t tests/diagnostics/bad-operator-call.slang(20): note 39999: 1 more overload candidates tests/diagnostics/bad-operator-call.slang(22): error 39999: no overload for '~' applicable to arguments of type (S) a = ~b; ^ -core.meta.slang(1629): note 39999: candidate: func ~(uint64_t) -> uint64_t -core.meta.slang(1626): note 39999: candidate: func ~(uint) -> uint -core.meta.slang(1623): note 39999: candidate: func ~(uint16_t) -> uint16_t -core.meta.slang(1620): note 39999: candidate: func ~(uint8_t) -> uint8_t -core.meta.slang(1617): note 39999: candidate: func ~(int64_t) -> int64_t -core.meta.slang(1614): note 39999: candidate: func ~(int) -> int -core.meta.slang(1611): note 39999: candidate: func ~(int16_t) -> int16_t -core.meta.slang(1608): note 39999: candidate: func ~(int8_t) -> int8_t +core.meta.slang(1632): note 39999: candidate: __prefix __intrinsic_op func ~(uint64_t) -> uint64_t +core.meta.slang(1629): note 39999: candidate: __prefix __intrinsic_op func ~(uint) -> uint +core.meta.slang(1626): note 39999: candidate: __prefix __intrinsic_op func ~(uint16_t) -> uint16_t +core.meta.slang(1623): note 39999: candidate: __prefix __intrinsic_op func ~(uint8_t) -> uint8_t +core.meta.slang(1620): note 39999: candidate: __prefix __intrinsic_op func ~(int64_t) -> int64_t +core.meta.slang(1617): note 39999: candidate: __prefix __intrinsic_op func ~(int) -> int +core.meta.slang(1614): note 39999: candidate: __prefix __intrinsic_op func ~(int16_t) -> int16_t +core.meta.slang(1611): note 39999: candidate: __prefix __intrinsic_op func ~(int8_t) -> int8_t tests/diagnostics/bad-operator-call.slang(27): error 30047: argument passed to parameter '0' must be l-value. a += c; ^ @@ -40,24 +40,24 @@ tests/diagnostics/bad-operator-call.slang(27): note 30048: argument was implicit tests/diagnostics/bad-operator-call.slang(31): error 39999: no overload for '+=' applicable to arguments of type (vector, vector) d += c; ^~ -core.meta.slang(1937): note 39999: candidate: func +=(out matrix, T) -> matrix -core.meta.slang(1929): note 39999: candidate: func +=(out matrix, matrix) -> matrix -core.meta.slang(1921): note 39999: candidate: func +=(out vector, T) -> vector -core.meta.slang(1913): note 39999: candidate: func +=(out vector, vector) -> vector -core.meta.slang(1905): note 39999: candidate: func +=(out T, T) -> T +core.meta.slang(1940): note 39999: candidate: __unsafeForceInlineEarly func +=(out matrix, T) -> matrix +core.meta.slang(1932): note 39999: candidate: __unsafeForceInlineEarly func +=(out matrix, matrix) -> matrix +core.meta.slang(1924): note 39999: candidate: __unsafeForceInlineEarly func +=(out vector, T) -> vector +core.meta.slang(1916): note 39999: candidate: __unsafeForceInlineEarly func +=(out vector, vector) -> vector +core.meta.slang(1908): note 39999: candidate: __unsafeForceInlineEarly func +=(out T, T) -> T tests/diagnostics/bad-operator-call.slang(33): error 39999: no overload for '+' applicable to arguments of type (vector, vector) d = c + d; ^ -core.meta.slang(1748): note 39999: candidate: func +<4>(vector, uint64_t) -> vector -core.meta.slang(1746): note 39999: candidate: func +<3>(uint64_t, vector) -> vector -core.meta.slang(1743): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(1741): note 39999: candidate: func +<4>(vector, uint) -> vector -core.meta.slang(1739): note 39999: candidate: func +<3>(uint, vector) -> vector -core.meta.slang(1736): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(1734): note 39999: candidate: func +<4>(vector, uint16_t) -> vector -core.meta.slang(1732): note 39999: candidate: func +<3>(uint16_t, vector) -> vector -core.meta.slang(1729): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t -core.meta.slang(1727): note 39999: candidate: func +<4>(vector, uint8_t) -> vector +core.meta.slang(1751): note 39999: candidate: __intrinsic_op func +<4>(vector, uint64_t) -> vector +core.meta.slang(1749): note 39999: candidate: __intrinsic_op func +<3>(uint64_t, vector) -> vector +core.meta.slang(1746): note 39999: candidate: __intrinsic_op func +(uint64_t, uint64_t) -> uint64_t +core.meta.slang(1744): note 39999: candidate: __intrinsic_op func +<4>(vector, uint) -> vector +core.meta.slang(1742): note 39999: candidate: __intrinsic_op func +<3>(uint, vector) -> vector +core.meta.slang(1739): note 39999: candidate: __intrinsic_op func +(uint, uint) -> uint +core.meta.slang(1737): note 39999: candidate: __intrinsic_op func +<4>(vector, uint16_t) -> vector +core.meta.slang(1735): note 39999: candidate: __intrinsic_op func +<3>(uint16_t, vector) -> vector +core.meta.slang(1732): note 39999: candidate: __intrinsic_op func +(uint16_t, uint16_t) -> uint16_t +core.meta.slang(1730): note 39999: candidate: __intrinsic_op func +<4>(vector, uint8_t) -> vector tests/diagnostics/bad-operator-call.slang(33): note 39999: 23 more overload candidates } standard output = { diff --git a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected index 930e71c5b..c3cb9e9c1 100644 --- a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected +++ b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected @@ -2,7 +2,7 @@ result code = -1 standard error = { tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): error 41011: type 'S' does not fit in the size required by its conforming interface. struct S : IInterface -^~~~~~ + ^ } standard output = { } diff --git a/tests/diagnostics/matrix-swizzle.slang.expected b/tests/diagnostics/matrix-swizzle.slang.expected index 6c9a14a00..832ddd739 100644 --- a/tests/diagnostics/matrix-swizzle.slang.expected +++ b/tests/diagnostics/matrix-swizzle.slang.expected @@ -2,43 +2,43 @@ result code = -1 standard error = { tests/diagnostics/matrix-swizzle.slang(8): error 30052: invalid swizzle pattern '_14' on type 'int' int c = m1._14; // Out of bounds - ^ + ^~~ tests/diagnostics/matrix-swizzle.slang(9): error 30052: invalid swizzle pattern '_32' on type 'int' c = m1._32; - ^ + ^~~ tests/diagnostics/matrix-swizzle.slang(10): error 30052: invalid swizzle pattern '_m22' on type 'int' c = m2._m22; - ^ + ^~~~ tests/diagnostics/matrix-swizzle.slang(11): error 30052: invalid swizzle pattern '_' on type 'int' c = m2._; // unfinished - ^ + ^ tests/diagnostics/matrix-swizzle.slang(12): error 30052: invalid swizzle pattern '_m' on type 'int' c = m2._m; - ^ + ^~ tests/diagnostics/matrix-swizzle.slang(13): error 30052: invalid swizzle pattern '_1' on type 'int' c = m2._1; - ^ + ^~ tests/diagnostics/matrix-swizzle.slang(14): error 30052: invalid swizzle pattern '_m1' on type 'int' c = m2._m1; - ^ + ^~~ tests/diagnostics/matrix-swizzle.slang(15): error 30052: invalid swizzle pattern '_m12_' on type 'int' c = m2._m12_; - ^ + ^~~~~ tests/diagnostics/matrix-swizzle.slang(16): error 30052: invalid swizzle pattern '_m11_11' on type 'int' int2 c2 = m1._m11_11; // Mixing of 1 and 0-indexing - ^ + ^~~~~~~ tests/diagnostics/matrix-swizzle.slang(17): error 30052: invalid swizzle pattern '_11_11_11_11_11' on type 'int' c = m1._11_11_11_11_11; // More than 4 elements - ^ + ^~~~~~~~~~~~~~~ tests/diagnostics/matrix-swizzle.slang(18): error 30052: invalid swizzle pattern 'x' on type 'int' c = m1.x; // Invalid character - ^ + ^ tests/diagnostics/matrix-swizzle.slang(19): error 30052: invalid swizzle pattern '_x' on type 'int' c = m1._x; - ^ + ^~ tests/diagnostics/matrix-swizzle.slang(20): error 30052: invalid swizzle pattern 'x123' on type 'int' c = m1.x123; - ^ + ^~~~ } standard output = { } diff --git a/tests/diagnostics/mismatching-types.slang.expected b/tests/diagnostics/mismatching-types.slang.expected index 2186a8d10..65a6df32e 100644 --- a/tests/diagnostics/mismatching-types.slang.expected +++ b/tests/diagnostics/mismatching-types.slang.expected @@ -11,16 +11,16 @@ tests/diagnostics/mismatching-types.slang(55): error 30019: expected an expressi ^ tests/diagnostics/mismatching-types.slang(57): error 30019: expected an expression of type 'GenericOuter.GenericInner', got 'GenericOuter.GenericInner' a.g = b.g; - ^ + ^ tests/diagnostics/mismatching-types.slang(59): error 30019: expected an expression of type 'GenericOuter.NonGenericInner', got 'GenericOuter.NonGenericInner' a.ng = b.ng; - ^ + ^~ tests/diagnostics/mismatching-types.slang(61): error 30019: expected an expression of type 'NonGenericOuter.GenericInner', got 'int' c.i = 0; ^ tests/diagnostics/mismatching-types.slang(63): error 30019: expected an expression of type 'NonGenericOuter.GenericInner', got 'NonGenericOuter.GenericInner' c.i = c.f; - ^ + ^ tests/diagnostics/mismatching-types.slang(65): error 30019: expected an expression of type 'NonGenericOuter.GenericInner.ReallyNested', got 'int' c.i.n = 0; ^ diff --git a/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected b/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected index dc6629470..27d8152f1 100644 --- a/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected +++ b/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected @@ -2,7 +2,7 @@ result code = -1 standard error = { tests/diagnostics/static-ref-to-nonstatic-member.slang(11): error 30100: type 'Color' cannot be used to refer to non-static member 'Red' int x = Color.Red; - ^ + ^~~ } standard output = { } diff --git a/tests/diagnostics/variable-redeclaration.slang.expected b/tests/diagnostics/variable-redeclaration.slang.expected index 03bed580b..d18e5fb2a 100644 --- a/tests/diagnostics/variable-redeclaration.slang.expected +++ b/tests/diagnostics/variable-redeclaration.slang.expected @@ -19,8 +19,8 @@ tests/diagnostics/variable-redeclaration.slang(20): note: see previous declarati tests/diagnostics/variable-redeclaration.slang(53): error 39999: ambiguous reference to 'size' return size; ^~~~ -tests/diagnostics/variable-redeclaration.slang(51): note 39999: candidate: size -tests/diagnostics/variable-redeclaration.slang(50): note 39999: candidate: size +tests/diagnostics/variable-redeclaration.slang(51): note 39999: candidate: float size +tests/diagnostics/variable-redeclaration.slang(50): note 39999: candidate: int size } standard output = { } -- cgit v1.2.3