Skip to content

Fix #133: Add missing boundary condition #149

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

Merged
merged 1 commit into from
Sep 15, 2020
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
4 changes: 2 additions & 2 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,15 @@ export const scalaTmLanguage: TmLanguage = {
inline: {
patterns: [
{
match: `\\b(inline)\\b(?=(?:.(?!val|def|given))*(if|match))`,
match: `\\b(inline)\\b(?=(?:.(?!\\b(?:val|def|given)\\b))*\\b(if|match)\\b)`,
captures: {
'1': {
name: 'keyword.control.flow.scala'
}
}
},
{
match: `\\b(inline)\\s+(?=(([\\w\\s]*(val|def|given))|(${plainid}|${backQuotedId})\\s*:))`,
match: `\\b(inline)\\s+(?=(([\\w\\s]*\\b(val|def|given)\\b)|(${plainid}|${backQuotedId})\\s*:))`,
captures: {
'1': {
name: 'storage.modifier.other'
Expand Down
49 changes: 49 additions & 0 deletions tests/unit/#133.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline xval match {
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline val1 match {
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline def1 match {
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline given1 match {
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline def power(x: Double, inline N: Int): Double =
// ^^^^^^ storage.modifier.other
Expand All @@ -40,6 +55,22 @@ val x = inline[T]
// ^^^^^^ storage.modifier.other
// ^^^^^^ variable.parameter.scala

inline def inline(inline xif: Int, inline ifx: Int): Double =
// ^^^^^^ storage.modifier.other
// ^^^^^^ entity.name.function.declaration
// ^^^^^^ storage.modifier.other
// ^^^ variable.parameter.scala
// ^^^^^^ storage.modifier.other
// ^^^ variable.parameter.scala

inline def inline(inline xmatch: Int, inline matchx: Int): Double =
// ^^^^^^ storage.modifier.other
// ^^^^^^ entity.name.function.declaration
// ^^^^^^ storage.modifier.other
// ^^^^^^ variable.parameter.scala
// ^^^^^^ storage.modifier.other
// ^^^^^^ variable.parameter.scala

inline if (n == 0) 1 else 2; val x = 2
// ^^^^^^ keyword.control.flow.scala
// ^^ keyword.control.flow.scala
Expand All @@ -51,3 +82,21 @@ val x = inline[T]
inline f[X](x: X) match {
// ^^^^^^ keyword.control.flow.scala
// ^^^^^ keyword.control.flow.scala

inline xval
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala

inline valx
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala

inline defx
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala

inline xdef
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala

inline givenx
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala

inline xgiven
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala