Skip to content
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
3 changes: 2 additions & 1 deletion Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ protected override void DependOnModule(Program program, ModuleDefinition module,
}
}

var import = CreateImport(module.GetCompileName(Options), module.IsDefaultModule, externModule, libraryName);
var publicModuleName = PublicModuleIdProtect(module.GetCompileName(Options));
var import = CreateImport(publicModuleName, module.IsDefaultModule, externModule, libraryName);
import.Path = goModuleName + import.Path;
AddImport(import);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ module {:options "--function-syntax:4"} CoolLibraryName {

}
}

// Ensuring reserved names in some languages are escaped consistently across languages
module Math {
function Add(x: int, y: int): int {
x + y
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ include "Inputs/producer/timesTwo.dfy"
module ConsumerModule {

import opened CoolLibraryName.LibraryModule
import Math

method Main() {
var n := 21;
var TwoN := TimesTwo(n);
print "Two times ", n, " is ", TwoN, "\n";

var z := Math.Add(20, 22);
print "20 plus 22 is ", z, "\n";

// Need to actually execute the use of nat's type descriptor
// to ensure it works on dynamic language targets.
var aNat := PickANat();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Two times 21 is 42
20 plus 22 is 42
Two times 21 is 42
20 plus 22 is 42
Two times 21 is 42
20 plus 22 is 42
Two times 21 is 42
20 plus 22 is 42