titan-lang / titan

The Titan programming language
http://titan-lang.org
MIT License
406 stars 13 forks source link

test: call a method from a returned record #236

Closed hishamhm closed 6 years ago

hishamhm commented 6 years ago

A failing test case

codecov-io commented 6 years ago

Codecov Report

Merging #236 into master will increase coverage by 0.02%. The diff coverage is 100%.

Impacted Files Coverage Δ
titan-compiler/coder.lua 96.37% <100%> (ø) :arrow_up:
titan-compiler/checker.lua 89.93% <0%> (+0.1%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2c09bf8...4b58627. Read the comment docs.

mascarenhas commented 6 years ago

Fixed. The test for whether a function call is a foreign call was expecting the function expression to be an lvalue, but this is not always the case for method calls. I commited quick fix, but we should really improve the handling of all the different kinds of calls and receivers of these calls...

I am always a proponent of different types for different things, so we should probably reserve Type.Function for first-class functions and then have Type.FirstOrderFunction, Type.ForeignFunction, Type.RecordFunction (the current Type.StaticMethod), and Type.Method as distinct types for the kinds of callables that we have. It also wouldn't hurt to split ExpCall into ExpCall and ExpMethodCall...

@hishamhm, I will leave this for you to merge this so you can see this comment.

hishamhm commented 6 years ago

Agreed! Thank you, @mascarenhas!