
727 P.2d 111 (1986)
302 Or. 115
Robert C. CABAL and Julie A. Cabal, husband and wife, Respondents on review,
v.
William G. DONNELLY, dba Donnelly and Jenner Construction, Defendant,
Herbert D. Jenner, dba Donnelly and Jenner Construction, Petitioner on review.
TC 20-803; CA A33370; SC S32733.
Supreme Court of Oregon, In Banc.
Argued and Submitted June 4, 1986.
Decided October 21, 1986.
J. Michael Alexander, Salem, argued the cause for petitioner on review. With him on the petition was Burt, Swanson, Lathen, Alexander & McCann, Salem.
Donald M. Kelley, Silverton, argued the cause for respondent on review. With him on the brief was Kelley & Kelley, Silverton.
GILLETTE, Justice.
This case presents the question whether an action by the purchasers of a new home (plaintiffs) against their builder-vendor (defendant)[1] under the implied warranty that the home was fit for habitation is an action on a contractthereby entitling the prevailing party to attorney fees under their earnest money agreementor an action in tortwith no attorney fees awarded. The trial court ruled the case was one "sounding" in tort. The Court of Appeals reversed. Cabal v. Donnelly, 78 Or.App. 56, 714 P.2d 1071 (1986). We affirm the Court of Appeals.
Prior to the sale, the parties entered into an earnest money agreement which provided, inter alia:
"In any suit or action brought on this contract, the losing party therein agrees to pay the prevailing party therein (1) the *112 prevailing party's reasonable attorney's fees in such suit or action, to be fixed by the trial court, and (2) on appeal, if any, similar fees in the appellate court, to be fixed by the appellate court."
The earnest money agreement did not specify the standard of workmanship to be employed or the expected quality of the finished house. After plaintiffs moved into the house, they discovered several defects in it and commenced this action.
The complaint set forth two claims for relief. In the first, plaintiffs alleged that, under the earnest money agreement, defendant "impliedly represented" that all plumbing and bathroom fixtures, equipment and septic systems would be in good working order and would conform to applicable health and sanitation requirements. The complaint alleged various defects in the finished house as breaches of this implied representation. Plaintiffs sought damages and, pursuant to the earnest money agreement, reasonable attorney fees.
In their second claim for relief, plaintiffs alleged that defendant had impliedly warranted that the house would be habitable. Plaintiffs realleged the defects set out in their first claim for relief as breaches of the implied warranty. The second claim for relief did not include a claim for attorney fees.
The trial court found that, "without a question," plaintiffs had proven the defects alleged in the complaint. However, the court concluded that, because there was no express agreement regarding the plumbing, septic system and the like, there could be no breach of contract; it therefore denied relief under that claim. The court also found that under the rule set out in Yepsen v. Burgess, 269 Or. 635, 525 P.2d 1019 (1974), defendant had made an implied warranty of habitability. Judgment was awarded on the implied warranty, but the court declined to award any attorney fees because entitlement to them had not been pleaded under this claim for relief. Plaintiffs appealed the denial of attorney fees.
The Court of Appeals reversed and, "with some trepidation," held that a breach of an implied warranty of habitability gives rise to an action in contract rather than in tort. Cabal v. Donnelly, supra, 78 Or. App. at 58, 714 P.2d 1071. Because it found that the action was based on the contract, the Court of Appeals concluded that the trial court erred in failing to award attorney fees to plaintiffs as provided by the earnest money agreement. Id. We allowed review in order to consider the proper characterization of an action for breach of an implied warranty of habitability.

I
At the outset, we must address a procedural matter raised by defendant. Plaintiffs did not claim attorney fees under the implied warranty claim for relief. After the trial court issued its letter opinion finding they were entitled to prevail on their second claim for relief, plaintiffs sought to amend their complaint to include a claim for attorney fees in that claim. The trial court denied the motion. Defendant contends that the only issue properly before this court is whether the trial court abused its discretion in denying plaintiffs' motion to amend their complaint. If the trial court's action in denying leave to amend at that point lay within the range of its discretion, defendant argues, plaintiffs are foreclosed from recovering attorney fees because they failed to plead them under the appropriate claim for relief. See ORCP 68 C(2).
We conclude that the defect in pleading, if such it was, is not dispositive. In substance, the two claims set out in plaintiffs' complaint were identical. The only difference was that plaintiffs alleged an "implied representation" in their first claim for relief and an "implied warranty" in their second claim for relief.[2] It is clear *113 from the letter opinion that the trial court denied plaintiffs' first, "contract," claim only because it believed that breach of an express term of the contract was necessary. This, then, is the pivotal issue. If a breach of an implied warranty gives rise to a contract action, then the trial court erred in ruling against plaintiffs' contract claim and, consequently, their claim for attorney fees. The motion to amend and its denial play no role. We turn to the merits.

II
When a vendor builds a new house for the purpose of sale to the general public, the sale of the house carries with it an implied warranty that the house was constructed in a reasonably workmanlike manner and is fit for habitation. Yepsen v. Burgess, supra, 269 Or. at 640-41, 525 P.2d 1019. In Beveridge v. King, 50 Or. App. 585, 623 P.2d 1132 (1981), the Court of Appeals held that an action for breach of the implied warranty of habitability sounded in contract and, therefore, was governed by the six-year statute of limitations applicable to contract actions. See ORS 12.080(1). The defendant in Beveridge argued that the following statute barred the action:
"An action for * * * any injury to the person or rights of another, not arising on contract, and not especially enumerated in this chapter [ORS chapter 12], shall be commenced within two years * * *." ORS 12.110(1) (emphasis added).[3]
This court granted review and affirmed, but on alternative grounds. We held that the general two-year statute of limitations did not apply either because the action was one in contract or because the action was to recover damages for injury to the interests of another in real property and, as such, was specifically enumerated in ORS 12.080(3). Beveridge v. King, 292 Or. 771, 778-79, 643 P.2d 332 (1982). With regard to the first alternative, we noted:
"In Schmauch v. Johnston, 274 Or 441, 547 P.2d 119 (1976), there was a written contract in which defendants had agreed to build a home for a sum certain, including the price of the lot. There the contract expressly provided that the building `shall be constructed in a good workmanlike manner.' Plaintiffs `discovered numerous defects and omissions in the construction of the home.' They sought damages in a sum equal to the cost of remedying the defects. In describing the cause of action, we stated: `This is an action to recover damages for breach of contract.' 274 Or. at 443, 547 P.2d at 120.
"Except for the circumstance that the obligation to construct in a workmanlike manner was express rather than implied, the cause in Schmauch was the same as that pleaded in the case at bar. If the cause predicated upon the express obligation was an action to recover damages for breach of contract, it would seem to follow that the cause on the implied obligation is also for damages for breach of contract." 292 Or. at 776, 643 P.2d 332.
Beveridge, however, left open the question whether an action on an implied warranty of habitability is one in contract or in tort. The issue is squarely presented in this case.
The implied warranty of habitability is a relatively recent encroachment on the ancient doctrine of caveat emptor. See Roberts, The Case of the Unwary Home Buyer: The Housing Merchant Did It, 52 Cornell L.Q. 835 (1967). Since its creation, opinion has been divided on whether the *114 action should be characterized as one in tort or contract. Compare Velotta v. Leo Petronzion Landscaping, Inc., 69 Ohio St.2d 376, 378-79, 433 N.E.2d 147 (1982) and Humber v. Morton, 426 S.W.2d 554 (Tex.1968) (holding that the action sounds in tort), with Woodward v. Chirco Construction Co., 141 Ariz. 514, 687 P.2d 1269 (1984), and authorities cited therein (holding that breach of implied warranty of habitability gives rise to an action in either contract or tort).
Historically, there has been a measure of understandable confusion surrounding this area of the law. In Securities-Intermountain v. Sunset Fuel, 289 Or. 243, 259, 611 P.2d 1158 (1980), we described the difference between the two causes of action as follows:
"* * * If the alleged contract merely incorporates by reference or by implication a general standard of skill and care to which the defendant would be bound independent of the contract, and the alleged breach would also be a breach of this noncontractual duty, then ORS 12.110 [statute of limitations applicable to tort actions] applies. Dowell v. Mossberg, [226 Or. 173, 355 P.2d 624, 359 P.2d 541 (1961) ] supra. Conversely, the parties may have spelled out the performance expected by the plaintiff and promised by the defendant in terms that commit the defendant to this performance without reference to and irrespective of any general standard. Such a defendant would be liable on the contract whether he was negligent or not, and regardless of facts that might excuse him from tort liability."
Defendant argues that the implied warranty of habitability imposes a general standard applicable to all vendor-builders of new homes and that, under the language of Securities-Intermountain, a breach of that general standard gives rise to a tort claim rather than a contract claim. What defendant fails to recognize is that the implied warranty of habitability has a dual nature: it establishes not only the standard of workmanship to be employed, but also the expected quality of the finished home the subject matter of the contract. Where, as here, the injury is one directly contemplated by the contract of sale, i.e., decreased value of premises due to failure to make them habitable, it is the contract that has been breached. See Beveridge v. King, supra, 292 Or. at 775 n. 4, 643 P.2d 332.
This approach is consistent with that of the Arizona Supreme Court in Woodward v. Chirco Construction Co., supra, where the court said:
"* * * [W]e agree with those jurisdictions that have held that injury incurred due to negligent construction of a residence may give rise to an action for breach of the implied warranty of workmanlike performance and habitability and an action for breach of the contractor's common law duty of care. * * * We believe this view fosters the policy considerations behind recognition of the warranty * * *. We see no reason to preclude a purchaser from claiming damages in contract and in tort. The purchaser of a home can seek to recover in contract for defects in the structure itself as such defects render the home less than the purchaser bargained for. * * *." 141 Ariz. at 515-16, 687 P.2d 1269-70 (emphasis added).
In Yepson v. Burgess, supra, this court stated that, "although a house becomes a part of the realty according to the technical law of accession, the purchaser sees the transaction primarily as the purchase of a house with the land only as an incident thereto." 269 Or. at 640, 525 P.2d 1019. The implication is that the purchaser enters into the contract for the purpose of buying a place to live. If the finished structure is not habitable, the purpose of the contract is defeated.
In the present case, the trial court found that the plumbing and bathroom fixtures, equipment and septic system were so defective that they rendered the house uninhabitable.[4] The impact of these defects *115 can be stated in simple terms. The plaintiffs in this case contracted to buy a residence. What they got was something less. We hold that plaintiffs' action for breach of warranty was an action on their contract with defendant. As provided by the contract, therefore, plaintiffs are entitled to reasonable attorney fees.
The decision of the Court of Appeals reversing the trial court is affirmed.
NOTES
[1]  The trial court entered judgment against both defendants Jenner and Donnelly. Defendant Donnelly, however, is not named as a respondent or cross-appellant in this appeal.
[2]  Defendant does not suggest that an "implied representation" differs from an "implied warranty." We note that, in this case at least, the trial court could not have found that defendant made an implied warranty but not an implied representation. In his answer, defendant admitted making most of the implied representations alleged in the complaint.
[3]  The defendant also argued that the special two-year statute of limitations applicable to "[a]n action to recover damages for injuries to a person or to property arising from another person having performed the construction, alteration or repair of any improvement to real property * * *" applied. ORS 12.135(1). In Securities-Intermountain v. Sunset Fuel, 289 Or. 243, 611 P.2d 1158 (1980), we held that ORS 12.135(1) applied to actions for bodily injury and physical injury to existing tangible property, not to cases involving financial losses resulting from inadequate or incomplete performance of the work or services described in that statute.
[4]  It seems clear that, had defendant failed to install any plumbing or septic system, plaintiffs would have had an action for breach of contract. The distinction between nonfeasance of a contractual obligation as a breach of contract and misfeasance of the same obligation as a tort has frequently been drawn. See Prosser and Keeton, Torts § 92, at 658-60 (5th ed 1984). To hold that the parties had this distinction in mind at the time of contracting, however, would be ludicrous.
