Skip to content

Allowed digits at the end of method return type #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
@@ -37,13 +37,13 @@ repository:
end: (?=$|[;,])
patterns:
- include: '#ternary-operator'
- include: '#expression-type'
- include: '#expression-type'

ternary-operator:
begin: (\?)
end: (:)
patterns:
- include: '#expression-type'
- include: '#expression-type'

expression-type:
name: meta.expression.ts
@@ -63,7 +63,7 @@ repository:
- include: '#logic-operator'
- include: '#assignment-operator'
- include: '#type-primitive'
- include: '#function-call'
- include: '#function-call'

control-statement:
name: keyword.control.ts
@@ -307,7 +307,7 @@ repository:
type-annotation:
name: meta.type.annotation.ts
begin: ":"
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{)
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[\w$])\s*(?=\{)
patterns:
- include: '#expression-operator'
- include: '#type'
2 changes: 1 addition & 1 deletion TypeScript.tmLanguage
Original file line number Diff line number Diff line change
@@ -1604,7 +1604,7 @@
<key>begin</key>
<string>:</string>
<key>end</key>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[a-zA-Z_$])\s*(?=\{)</string>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[\w$])\s*(?=\{)</string>
<key>name</key>
<string>meta.type.annotation.ts</string>
<key>patterns</key>
8 changes: 8 additions & 0 deletions tests/baselines/Issue188.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[9, 22]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.type.annotation.ts meta.type.name.ts
[9, 29]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts meta.brace.curly.ts
[12, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
[12, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts constant.language.this.ts
[24, 22]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.type.annotation.ts meta.type.name.ts
[24, 30]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts meta.brace.curly.ts
[27, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
[27, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts constant.language.this.ts
29 changes: 29 additions & 0 deletions tests/cases/Issue188.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Matrix {

public elements;

constructor() {
this.elements = new Float32Array([1]);
}

set(m11: number) : ^^Matrix ^^{
this.elements[0] = m11;

^^return ^^this;
}
}

class Matrix1 {

public elements;

constructor() {
this.elements = new Float32Array([1]);
}

set(m11: number) : ^^Matrix1 ^^{
this.elements[0] = m11;

^^return ^^this;
}
}