Skip to content
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

Validate language argument of translate command #3274

4 changes: 2 additions & 2 deletions Source/DafnyDriver/DafnyDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ public static CommandLineArgumentsResult ProcessCommandLineArguments(string[] ar
var compilers = options.Plugins.SelectMany(p => p.GetCompilers()).ToList();
var compiler = compilers.LastOrDefault(c => c.TargetId == nonOutOptions.CompilerName);
if (compiler == null) {
if (options.Compile) {
if (nonOutOptions.CompilerName != null) {
var known = String.Join(", ", compilers.Select(c => $"'{c.TargetId}' ({c.TargetLanguage})"));
options.Printer.ErrorWriteLine(Console.Error, $"No compiler found for compileTarget \"{options.CompilerName}\"; expecting one of {known}");
options.Printer.ErrorWriteLine(Console.Error, $"No compiler found for language \"{options.CompilerName}\"{(options.CompilerName.StartsWith("-t") || options.CompilerName.StartsWith("--") ? " (use just a language name, not a -t or --target option)" : "")}; expecting one of {known}");
return CommandLineArgumentsResult.PREPROCESSING_ERROR;
}

Expand Down