Skip to content

Commit 0c8884b

Browse files
authored
adds a test case (#1109)
1 parent d72022b commit 0c8884b

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

src/nimony/sembasics.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ proc buildErr*(c: var SemContext; info: PackedLineInfo; msg: string; orig: Curso
167167
when defined(debug):
168168
if not c.debugAllowErrors:
169169
writeStackTrace()
170+
for instFrom in items(c.instantiatedFrom):
171+
echo "instantiated from: ", infoToStr(instFrom)
172+
170173
echo infoToStr(info) & " Error: " & msg
171174
if orig.kind != DotToken:
172175
echo "Source: ", toString(orig, false)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
type
3+
ImportedObject* = object
4+
private: int
5+
public*: string
6+
7+
GenObj*[T] = object
8+
private: T
9+
public*: T
10+
11+
proc importedProc*(): ImportedObject = ImportedObject(private: 4, public: "abc")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tests/nimony/lookups/tprivatefield.nim(6, 1) Error: undeclared field: 'private=' for type ImportedObject.0.mpruewjqm1
2+
tests/nimony/lookups/tprivatefield.nim(8, 38) Error: undeclared field: 'private' for type ImportedObject.0.mpruewjqm1
3+
tests/nimony/lookups/tprivatefield.nim(10, 33) Error: undeclared field: 'private' for type GenObj.0.Irgvple1.tprac4dzs1
4+
tests/nimony/lookups/tprivatefield.nim(11, 10) Error: undeclared field: 'private' for type GenObj.0.Irgvple1.tprac4dzs1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
import deps / mprivatefield
3+
4+
var x = importedProc() #: ImportedObject
5+
x.public = "valid"
6+
x.private = 0
7+
8+
var y = ImportedObject(public: "my", private: 45)
9+
10+
let z = GenObj[int](public: 12, private: 89)
11+
discard z.private

0 commit comments

Comments
 (0)