Skip to content

Subsequent variable declarations must have same type: Mention location of other declaration#19356

Merged
2 commits merged into
masterfrom
subsequent
Oct 20, 2017
Merged

Subsequent variable declarations must have same type: Mention location of other declaration#19356
2 commits merged into
masterfrom
subsequent

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Oct 19, 2017

Fixes #19339

@ghost ghost requested a review from sandersn October 19, 2017 22:09
Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor naming/formatting changes.

Comment thread src/compiler/checker.ts Outdated
const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration);
const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration);
const otherLocation = getLineAndCharacterOfPosition(valueDeclarationSourceFile, otherSpan.start);
const otherLocationDescription = `${valueDeclarationSourceFile.fileName} ${otherLocation.line}:${otherLocation.character}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the chrome debugger issue with template literals fixed? It doesn't look like it, so probably it's better not avoid template literals for now.

Comment thread src/compiler/checker.ts Outdated
}
}

function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use 'Next' consistently for the function name and for -Type and -Declaration. It's easier to type than subsequent.

Comment thread src/compiler/checker.ts Outdated

function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void {
const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration);
const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and 'first/next' for local names too.

@ghost ghost merged commit d7be61a into master Oct 20, 2017
@ghost ghost deleted the subsequent branch October 20, 2017 15:33
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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.

1 participant