Browse Source

changed error message for unexpected keywords (closes #7602)

Aleksandr Kuzmenko 4 years ago
parent
commit
4c89e4724e
2 changed files with 2 additions and 1 deletions
  1. 1 0
      src/syntax/parser.ml
  2. 1 1
      tests/display/src/cases/Issue7948.hx

+ 1 - 0
src/syntax/parser.ml

@@ -67,6 +67,7 @@ exception TypePath of string list * (string * bool) option * bool (* in import *
 exception SyntaxCompletion of syntax_completion * DisplayTypes.completion_subject
 exception SyntaxCompletion of syntax_completion * DisplayTypes.completion_subject
 
 
 let error_msg = function
 let error_msg = function
+	| Unexpected (Kwd k) -> "Unexpected keyword \""^(s_keyword k)^"\""
 	| Unexpected t -> "Unexpected "^(s_token t)
 	| Unexpected t -> "Unexpected "^(s_token t)
 	| Duplicate_default -> "Duplicate default"
 	| Duplicate_default -> "Duplicate default"
 	| Missing_semicolon -> "Missing ;"
 	| Missing_semicolon -> "Missing ;"

+ 1 - 1
tests/display/src/cases/Issue7948.hx

@@ -14,7 +14,7 @@ class Issue7948 extends DisplayTestCase {
 				kind: DKParserError,
 				kind: DKParserError,
 				severity: Error,
 				severity: Error,
 				range: diagnosticsRange(pos(1), pos(2)),
 				range: diagnosticsRange(pos(1), pos(2)),
-				args: "Unexpected class"
+				args: 'Unexpected keyword "class"'
 			}
 			}
 		], diagnostics());
 		], diagnostics());
 	}
 	}