Skip to content
Closed
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
4 changes: 3 additions & 1 deletion tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"
"sync"
"sync/atomic"
"unicode/utf8"

"github.com/microsoft/TypeScript/tsc/internal/ast"
"github.com/microsoft/TypeScript/tsc/internal/binder"
Expand Down Expand Up @@ -8774,7 +8775,8 @@ func (c *Checker) resolveCallExpression(node *ast.Node, candidatesOutArray *[]*S
if len(node.Arguments()) == 1 {
text := ast.GetSourceFileOfNode(node).Text()
options := scanner.SkipTriviaOptions{StopAfterLineBreak: true}
if stringutil.IsLineBreak(rune(text[scanner.SkipTriviaEx(text, node.Expression().End(), &options)-1])) {
pos := scanner.SkipTriviaEx(text, node.Expression().End(), &options)
if ch, _ := utf8.DecodeLastRuneInString(text[:pos]); stringutil.IsLineBreak(ch) {
Comment on lines +8778 to +8779
relatedInformation = createDiagnosticForNode(node.Expression(), diagnostics.Are_you_missing_a_semicolon)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tsc/internal/testutil/tsbaseline/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var (
lineDelimiter = regexp.MustCompile("\r?\n")
lineDelimiter = regexp.MustCompile("[\r\u2028\u2029]|\r?\n")
nonWhitespace = regexp.MustCompile(`\S`)
tsExtension = regexp.MustCompile(`\.tsx?$`)
testPathCharacters = regexp.MustCompile(`[\^<>:"|?*%]`)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
missingSemicolonUnicodeLineTerminator.ts(2,26): error TS2349: This expression is not callable.
Type 'Number' has no call signatures.
missingSemicolonUnicodeLineTerminator.ts(6,26): error TS2349: This expression is not callable.
Type 'Number' has no call signatures.
missingSemicolonUnicodeLineTerminator.ts(10,26): error TS2349: This expression is not callable.
Type 'Number' has no call signatures.


==== missingSemicolonUnicodeLineTerminator.ts (3 errors) ====
// U+2028 LINE SEPARATOR
const a = (x: number) => x
~
!!! error TS2349: This expression is not callable.
!!! error TS2349: Type 'Number' has no call signatures.
!!! related TS2734 missingSemicolonUnicodeLineTerminator.ts:2:26: Are you missing a semicolon?
(1);

// U+2029 PARAGRAPH SEPARATOR
const b = (x: number) => x
~
!!! error TS2349: This expression is not callable.
!!! error TS2349: Type 'Number' has no call signatures.
!!! related TS2734 missingSemicolonUnicodeLineTerminator.ts:6:26: Are you missing a semicolon?
(1);

// Standard newline for comparison
const c = (x: number) => x
~
!!! error TS2349: This expression is not callable.
!!! error TS2349: Type 'Number' has no call signatures.
!!! related TS2734 missingSemicolonUnicodeLineTerminator.ts:10:26: Are you missing a semicolon?
(1);

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//// [tests/cases/compiler/missingSemicolonUnicodeLineTerminator.ts] ////

//// [missingSemicolonUnicodeLineTerminator.ts]
// U+2028 LINE SEPARATOR
const a = (x: number) => x
(1);

// U+2029 PARAGRAPH SEPARATOR
const b = (x: number) => x
(1);

// Standard newline for comparison
const c = (x: number) => x
(1);


//// [missingSemicolonUnicodeLineTerminator.js]
"use strict";
// U+2028 LINE SEPARATOR
const a = (x) => x(1);
// U+2029 PARAGRAPH SEPARATOR
const b = (x) => x(1);
// Standard newline for comparison
const c = (x) => x(1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//// [tests/cases/compiler/missingSemicolonUnicodeLineTerminator.ts] ////

=== missingSemicolonUnicodeLineTerminator.ts ===
// U+2028 LINE SEPARATOR
const a = (x: number) => x
>a : Symbol(a, Decl(missingSemicolonUnicodeLineTerminator.ts, 1, 5))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 1, 11))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 1, 11))

(1);

// U+2029 PARAGRAPH SEPARATOR
const b = (x: number) => x
>b : Symbol(b, Decl(missingSemicolonUnicodeLineTerminator.ts, 5, 5))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 5, 11))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 5, 11))

(1);

// Standard newline for comparison
const c = (x: number) => x
>c : Symbol(c, Decl(missingSemicolonUnicodeLineTerminator.ts, 9, 5))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 9, 11))
>x : Symbol(x, Decl(missingSemicolonUnicodeLineTerminator.ts, 9, 11))

(1);

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//// [tests/cases/compiler/missingSemicolonUnicodeLineTerminator.ts] ////

=== missingSemicolonUnicodeLineTerminator.ts ===
// U+2028 LINE SEPARATOR
const a = (x: number) => x
>a : (x: number) => any
>(x: number) => x(1) : (x: number) => any
>x : number
>x(1) : any
>x : number

(1);
>1 : 1

// U+2029 PARAGRAPH SEPARATOR
const b = (x: number) => x
>b : (x: number) => any
>(x: number) => x(1) : (x: number) => any
>x : number
>x(1) : any
>x : number

(1);
>1 : 1

// Standard newline for comparison
const c = (x: number) => x
>c : (x: number) => any
>(x: number) => x(1) : (x: number) => any
>x : number
>x(1) : any
>x : number

(1);
>1 : 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @target: esnext

// U+2028 LINE SEPARATOR
const a = (x: number) => x
(1);

// U+2029 PARAGRAPH SEPARATOR
const b = (x: number) => x
(1);

// Standard newline for comparison
const c = (x: number) => x
(1);