Skip to content

(interpreter) Add infrastructure for compiler warnings#190

Merged
perlun merged 1 commit intomasterfrom
feature/add-compiler-warning-infrastructure
May 12, 2021
Merged

(interpreter) Add infrastructure for compiler warnings#190
perlun merged 1 commit intomasterfrom
feature/add-compiler-warning-infrastructure

Conversation

@perlun
Copy link
Copy Markdown
Collaborator

@perlun perlun commented May 9, 2021

Extracting of most of the infrastructure code from #188, to make that PR clearer and more focused on the actual semantic changes.

@perlun perlun added the enhancement New feature or request label May 9, 2021
@perlun perlun added this to the 0.1.0 milestone May 9, 2021
dotnet publish Perlang.ConsoleApp/Perlang.ConsoleApp.csproj -c Release -r linux-x64 --self-contained true /p:PublishReadyToRun=true /p:SolutionDir=$(pwd)/
cp -r Perlang.ConsoleApp/bin/Release/net5.0/linux-x64/publish/* $HOME/.perlang/nightly/bin
dotnet publish src/Perlang.ConsoleApp/Perlang.ConsoleApp.csproj -c Release -r linux-x64 --self-contained true /p:PublishReadyToRun=true /p:SolutionDir=$(pwd)/
cp -r src/Perlang.ConsoleApp/bin/Release/net5.0/linux-x64/publish/* $HOME/.perlang/nightly/bin
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

(Drive-by bug fix for something which was forgotten in #167. One new idea I had while reviewing this: it would perhaps be worth running this script in CI, to prevent bugs like this from slipping through.)

@perlun perlun force-pushed the feature/add-compiler-warning-infrastructure branch from 134652b to 4309b43 Compare May 9, 2021 04:46
private readonly PerlangInterpreter interpreter;
private readonly Action<string> standardOutputHandler;
private readonly Action<string> standardErrorHandler;
private readonly HashSet<WarningType> disabledWarningsAsErrors = new();
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note: this MR does not include any mechanism for actually populating this field. Will be handled by #188.


namespace Perlang.ConsoleApp
{
// TODO: Remove this class if/when https://github.com/dotnet/command-line-api/pull/1272 gets merged.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@perlun perlun force-pushed the feature/add-compiler-warning-infrastructure branch from 4309b43 to 64e2283 Compare May 9, 2021 04:48
Comment thread src/Perlang.ConsoleApp/Program.cs
@perlun perlun force-pushed the feature/add-compiler-warning-infrastructure branch from 64e2283 to cb65401 Compare May 9, 2021 04:51
@perlun perlun force-pushed the feature/add-compiler-warning-infrastructure branch from cb65401 to 64f21e1 Compare May 12, 2021 18:48
@perlun perlun force-pushed the feature/add-compiler-warning-infrastructure branch from 64f21e1 to 26e1af9 Compare May 12, 2021 18:53

Assert.Single(result.Errors);
Assert.Matches("Cannot assign nil to an implicitly typed local variable", exception.Message);
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This added test validates the new check in TypesResolvedValidator, added in this PR.


Assert.Single(result.Errors);
Assert.Matches("Cannot pass Perlang.NullObject argument as parameter 's: System.Int32'", exception.Message);
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

(AFAIK, the check that this test validates has been there previously already.)

@perlun perlun merged commit c1ca18f into master May 12, 2021
@perlun perlun deleted the feature/add-compiler-warning-infrastructure branch May 12, 2021 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant