Skip to content

Commit

Permalink
Tests build
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Oct 25, 2024
1 parent 74cbbb9 commit 2d60496
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void VariableDocumentationComment(string docComment)
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Empty(semanticModel.Diagnostics);
Expand Down
16 changes: 8 additions & 8 deletions src/Draco.Compiler.Tests/Semantics/SymbolResolutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public void FuncOverloadsGlobalVar()
var semanticModel = compilation.GetSemanticModel(tree);
var diagnostics = semanticModel.Diagnostics;

var varSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(varDecl));
var varSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(varDecl));
var funcSym = GetInternalSymbol<FunctionSymbol>(semanticModel.GetDeclaredSymbol(funcDecl));

// Assert
Expand Down Expand Up @@ -465,8 +465,8 @@ public void GlobalVariableDefinedLater()
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var varRefSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetReferencedSymbol(localVarDecl.Value!.Value));
var varDeclSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(globalVarDecl));
var varRefSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetReferencedSymbol(localVarDecl.Value!.Value));
var varDeclSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(globalVarDecl));

// Assert
Assert.True(ReferenceEquals(varDeclSym, varRefSym));
Expand Down Expand Up @@ -570,7 +570,7 @@ public void GlobalCanNotReferenceGlobal()
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var xDeclSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xDeclSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xRefSym = semanticModel.GetReferencedSymbol(xRef);

// TODO: Should see it, but should report illegal reference error
Expand Down Expand Up @@ -1720,7 +1720,7 @@ public static class FooModule{

var diags = semanticModel.Diagnostics;
var xSym = GetInternalSymbol<VariableSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var fooSym = AssertMember<GlobalSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooSym = AssertMember<FieldSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooDecl = GetMetadataSymbol(compilation, null, "FooModule", "foo");

// Assert
Expand Down Expand Up @@ -1767,7 +1767,7 @@ public static class FooModule{

var diags = semanticModel.Diagnostics;
var xSym = GetInternalSymbol<VariableSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var fooSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetReferencedSymbol(fooNameRef));
var fooSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetReferencedSymbol(fooNameRef));
var fooDecl = GetMetadataSymbol(compilation, null, "FooModule", "foo");

// Assert
Expand Down Expand Up @@ -1855,7 +1855,7 @@ public static class FooModule{
var semanticModel = compilation.GetSemanticModel(main);

var diags = semanticModel.Diagnostics;
var fooSym = AssertMember<GlobalSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooSym = AssertMember<FieldSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooDecl = GetMetadataSymbol(compilation, null, "FooModule", "foo");

// Assert
Expand Down Expand Up @@ -1897,7 +1897,7 @@ public static class FooModule{
var semanticModel = compilation.GetSemanticModel(main);

var diags = semanticModel.Diagnostics;
var fooSym = AssertMember<GlobalSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooSym = AssertMember<FieldSymbol>(GetInternalSymbol<ModuleSymbol>(semanticModel.GetReferencedSymbol(fooModuleRef)), "foo");
var fooDecl = GetMetadataSymbol(compilation, null, "FooModule", "foo");

// Assert
Expand Down
12 changes: 6 additions & 6 deletions src/Draco.Compiler.Tests/Semantics/TypeCheckingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void GlobalVariableExplicitlyTyped()
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Empty(semanticModel.Diagnostics);
Expand All @@ -256,7 +256,7 @@ public void GlobalVariableTypeInferredFromValue()
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Empty(semanticModel.Diagnostics);
Expand All @@ -278,7 +278,7 @@ public void GlobalVariableExplicitlyTypedWithoutValue()
var compilation = CreateCompilation(tree);
var semanticModel = compilation.GetSemanticModel(tree);

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Empty(semanticModel.Diagnostics);
Expand All @@ -301,7 +301,7 @@ public void GlobalVariableTypeCanNotBeInferred()
var semanticModel = compilation.GetSemanticModel(tree);
var diags = semanticModel.Diagnostics;

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Single(diags);
Expand All @@ -328,7 +328,7 @@ public void GlobalVariableIncompatibleType()
var semanticModel = compilation.GetSemanticModel(tree);
var diags = semanticModel.Diagnostics;

var xSym = GetInternalSymbol<GlobalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var xSym = GetInternalSymbol<FieldSymbol>(semanticModel.GetDeclaredSymbol(xDecl));

// Assert
Assert.Single(diags);
Expand Down Expand Up @@ -1066,7 +1066,7 @@ public void AccessingField()
var semanticModel = compilation.GetSemanticModel(tree);

var xSym = GetInternalSymbol<LocalSymbol>(semanticModel.GetDeclaredSymbol(xDecl));
var stringEmptySym = AssertMember<GlobalSymbol>(GetInternalSymbol<TypeSymbol>(semanticModel.GetReferencedSymbol(consoleRef)), "Empty");
var stringEmptySym = AssertMember<FieldSymbol>(GetInternalSymbol<TypeSymbol>(semanticModel.GetReferencedSymbol(consoleRef)), "Empty");

// Assert
Assert.Empty(semanticModel.Diagnostics);
Expand Down

0 comments on commit 2d60496

Please sign in to comment.