Skip to content
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
3 changes: 3 additions & 0 deletions internal/testutil/harnessutil/harnessutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ func compileFilesWithHost(
if config.CompilerOptions().GetEmitDeclarations() {
diagnostics = append(diagnostics, program.GetDeclarationDiagnostics(ctx, nil)...)
}
if harnessOptions.CaptureSuggestions {
diagnostics = append(diagnostics, program.GetSuggestionDiagnostics(ctx, nil)...)
}
emitResult := program.Emit(compiler.EmitOptions{})

return newCompilationResult(config.CompilerOptions(), program, emitResult, diagnostics, harnessOptions)
Expand Down
110 changes: 109 additions & 1 deletion testdata/baselines/reference/submodule/compiler/overshifts.errors.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
overshifts.ts(2,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
overshifts.ts(3,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 27`.
overshifts.ts(4,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
overshifts.ts(6,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
overshifts.ts(7,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << -27`.
overshifts.ts(8,1): suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
overshifts.ts(11,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
overshifts.ts(12,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 27`.
overshifts.ts(13,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
overshifts.ts(15,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
overshifts.ts(16,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> -27`.
overshifts.ts(17,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
overshifts.ts(20,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
overshifts.ts(21,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 27`.
overshifts.ts(22,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
overshifts.ts(24,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
overshifts.ts(25,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> -27`.
overshifts.ts(26,1): suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
overshifts.ts(30,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
overshifts.ts(31,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 27`.
overshifts.ts(32,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
overshifts.ts(34,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
overshifts.ts(35,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= -27`.
overshifts.ts(36,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
overshifts.ts(39,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
overshifts.ts(40,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 27`.
overshifts.ts(41,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
overshifts.ts(43,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
overshifts.ts(44,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= -27`.
overshifts.ts(45,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
overshifts.ts(48,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
overshifts.ts(49,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 27`.
overshifts.ts(50,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
overshifts.ts(52,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
overshifts.ts(53,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= -27`.
overshifts.ts(54,1): suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
overshifts.ts(58,9): error TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
overshifts.ts(59,9): error TS6807: This operation can be simplified. This shift is identical to `1 << 27`.
overshifts.ts(60,9): error TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
Expand All @@ -18,61 +54,133 @@ overshifts.ts(85,9): error TS6807: This operation can be simplified. This shift
overshifts.ts(86,9): error TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.


==== overshifts.ts (18 errors) ====
==== overshifts.ts (54 errors) ====
1 << 1; // ok
1 << 32; // overshift
~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
1 << 123;
~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 27`.
1 << 1024;
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
1 << -1; // OK-ish
1 << -32; // backwards overshift
~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.
1 << -123;
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << -27`.
1 << -1024;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `1 << 0`.

0xFF_FF_FF_FF >> 1; // ok
0xFF_FF_FF_FF >> 32; // overshift
~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
0xFF_FF_FF_FF >> 123;
~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 27`.
0xFF_FF_FF_FF >> 1024;
~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
0xFF_FF_FF_FF >> -1; // OK-ish
0xFF_FF_FF_FF >> -32; // backwards overshift
~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.
0xFF_FF_FF_FF >> -123;
~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> -27`.
0xFF_FF_FF_FF >> -1024;
~~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >> 0`.

0xFF_FF_FF_FF >>> 1; // ok
0xFF_FF_FF_FF >>> 32; // overshift
~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
0xFF_FF_FF_FF >>> 123;
~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 27`.
0xFF_FF_FF_FF >>> 1024;
~~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
0xFF_FF_FF_FF >>> -1; // OK-ish
0xFF_FF_FF_FF >>> -32; // backwards overshift
~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.
0xFF_FF_FF_FF >>> -123;
~~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> -27`.
0xFF_FF_FF_FF >>> -1024;
~~~~~~~~~~~~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `0xFF_FF_FF_FF >>> 0`.

let x = 1;
x <<= 1; // ok
x <<= 32; // overshift
~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
x <<= 123;
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 27`.
x <<= 1024;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
x <<= -1; // OK-ish
x <<= -32; // backwards overshift
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.
x <<= -123;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= -27`.
x <<= -1024;
~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x <<= 0`.

x >>= 1; // ok
x >>= 32; // overshift
~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
x >>= 123;
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 27`.
x >>= 1024;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
x >>= -1; // OK-ish
x >>= -32; // backwards overshift
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.
x >>= -123;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= -27`.
x >>= -1024;
~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>= 0`.

x >>>= 1; // ok
x >>>= 32; // overshift
~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
x >>>= 123;
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 27`.
x >>>= 1024;
~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
x >>>= -1; // OK-ish
x >>>= -32; // backwards overshift
~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.
x >>>= -123;
~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= -27`.
x >>>= -1024;
~~~~~~~~~~~~
!!! suggestion TS6807: This operation can be simplified. This shift is identical to `x >>>= 0`.

enum One {
A = 1 << 1, // ok
Expand Down
Loading